mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
* chore: add /v2 to import module path go mod requires semantic versioning with versions greater than 1.x This was a mechanical update by running: ``` go install github.com/marwan-at-work/mod/cmd/mod@latest mod upgrade ``` Migrate generated files to import /v2 * Fix gen
57 lines
1.6 KiB
Go
57 lines
1.6 KiB
Go
package cli_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/coder/coder/v2/cli/clitest"
|
|
"github.com/coder/coder/v2/codersdk"
|
|
"github.com/coder/coder/v2/enterprise/coderd/coderdenttest"
|
|
"github.com/coder/coder/v2/enterprise/coderd/license"
|
|
"github.com/coder/coder/v2/pty/ptytest"
|
|
"github.com/coder/coder/v2/testutil"
|
|
)
|
|
|
|
func TestProvisionerDaemon_PSK(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
client, _ := coderdenttest.New(t, &coderdenttest.Options{
|
|
ProvisionerDaemonPSK: "provisionersftw",
|
|
LicenseOptions: &coderdenttest.LicenseOptions{
|
|
Features: license.Features{
|
|
codersdk.FeatureExternalProvisionerDaemons: 1,
|
|
},
|
|
},
|
|
})
|
|
inv, conf := newCLI(t, "provisionerd", "start", "--psk=provisionersftw")
|
|
err := conf.URL().Write(client.URL.String())
|
|
require.NoError(t, err)
|
|
pty := ptytest.New(t).Attach(inv)
|
|
ctx, cancel := context.WithTimeout(inv.Context(), testutil.WaitLong)
|
|
defer cancel()
|
|
clitest.Start(t, inv)
|
|
pty.ExpectMatchContext(ctx, "starting provisioner daemon")
|
|
}
|
|
|
|
func TestProvisionerDaemon_SessionToken(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
client, _ := coderdenttest.New(t, &coderdenttest.Options{
|
|
ProvisionerDaemonPSK: "provisionersftw",
|
|
LicenseOptions: &coderdenttest.LicenseOptions{
|
|
Features: license.Features{
|
|
codersdk.FeatureExternalProvisionerDaemons: 1,
|
|
},
|
|
},
|
|
})
|
|
inv, conf := newCLI(t, "provisionerd", "start")
|
|
clitest.SetupConfig(t, client, conf)
|
|
pty := ptytest.New(t).Attach(inv)
|
|
ctx, cancel := context.WithTimeout(inv.Context(), testutil.WaitLong)
|
|
defer cancel()
|
|
clitest.Start(t, inv)
|
|
pty.ExpectMatchContext(ctx, "starting provisioner daemon")
|
|
}
|