mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +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>
29 lines
581 B
Go
29 lines
581 B
Go
package cli_test
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/coder/coder/cli/clitest"
|
|
"github.com/coder/coder/pty/ptytest"
|
|
)
|
|
|
|
func TestTemplateInit(t *testing.T) {
|
|
t.Parallel()
|
|
t.Run("Extract", func(t *testing.T) {
|
|
t.Parallel()
|
|
tempDir := t.TempDir()
|
|
cmd, _ := clitest.New(t, "templates", "init", tempDir)
|
|
pty := ptytest.New(t)
|
|
cmd.SetIn(pty.Input())
|
|
cmd.SetOut(pty.Output())
|
|
err := cmd.Execute()
|
|
require.NoError(t, err)
|
|
files, err := os.ReadDir(tempDir)
|
|
require.NoError(t, err)
|
|
require.Greater(t, len(files), 0)
|
|
})
|
|
}
|