mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
* fix: Guard against CLI cmd running after test exit * fix: cli: avoid calling t.FailNow in non-test-main goroutine * fix: cli: server_test: avoid calling t.FailNow outside main goroutine * fix: cli: clitest_test: avoid calling t.FailNow outside main goroutine * fix: cli: list_test: avoid calling t.FailNow outside main goroutine * fix: TestGitSSH use-of-t-after-exit * fix: TestGitSSH "too many authentication failures" Due to local SSH keys being given * chore: clitest: fix TestCli * chore: Simplify TestTemplateInit Co-authored-by: Cian Johnston <cian@coder.com>
31 lines
580 B
Go
31 lines
580 B
Go
package clitest_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"go.uber.org/goleak"
|
|
|
|
"github.com/coder/coder/cli/clitest"
|
|
"github.com/coder/coder/coderd/coderdtest"
|
|
"github.com/coder/coder/pty/ptytest"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
goleak.VerifyTestMain(m)
|
|
}
|
|
|
|
func TestCli(t *testing.T) {
|
|
t.Parallel()
|
|
clitest.CreateTemplateVersionSource(t, nil)
|
|
client := coderdtest.New(t, nil)
|
|
cmd, config := clitest.New(t)
|
|
clitest.SetupConfig(t, client, config)
|
|
pty := ptytest.New(t)
|
|
cmd.SetIn(pty.Input())
|
|
cmd.SetOut(pty.Output())
|
|
go func() {
|
|
_ = cmd.Execute()
|
|
}()
|
|
pty.ExpectMatch("coder")
|
|
}
|