Skip to content

Commit 7ea193f

Browse files
committed
add missing test for failing case
1 parent b5ff465 commit 7ea193f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

enterprise/cli/provisionerdaemonstart_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,28 @@ func TestProvisionerDaemon_ProvisionerKey(t *testing.T) {
339339
require.Equal(t, proto.CurrentVersion.String(), daemons[0].APIVersion)
340340
})
341341

342+
t.Run("NoProvisionerKeyFound", func(t *testing.T) {
343+
t.Parallel()
344+
345+
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
346+
defer cancel()
347+
client, _ := coderdenttest.New(t, &coderdenttest.Options{
348+
ProvisionerDaemonPSK: "provisionersftw",
349+
LicenseOptions: &coderdenttest.LicenseOptions{
350+
Features: license.Features{
351+
codersdk.FeatureExternalProvisionerDaemons: 1,
352+
codersdk.FeatureMultipleOrganizations: 1,
353+
},
354+
},
355+
})
356+
357+
inv, conf := newCLI(t, "provisionerd", "start", "--key", "ThisKeyDoesNotExist", "--name=matt-daemon")
358+
err := conf.URL().Write(client.URL.String())
359+
require.NoError(t, err)
360+
err = inv.WithContext(ctx).Run()
361+
require.ErrorContains(t, err, "unable to get provisioner key details")
362+
})
363+
342364
t.Run("NoPSK", func(t *testing.T) {
343365
t.Parallel()
344366

0 commit comments

Comments
 (0)