Skip to content

Commit

Permalink
logging for test
Browse files Browse the repository at this point in the history
  • Loading branch information
strowk committed Dec 8, 2024
1 parent a2e7271 commit 5fc67f7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (

require (
github.com/stretchr/testify v1.9.0
github.com/strowk/foxy-contexts v0.0.4-0.20241208035607-078a2e5414fd
github.com/strowk/foxy-contexts v0.0.4-0.20241208040801-98ae5bd5e918
go.uber.org/mock v0.5.0
k8s.io/api v0.31.3
)
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ github.com/strowk/foxy-contexts v0.0.4-0.20241208034254-a127d64fc38a h1:uI7o/4BJ
github.com/strowk/foxy-contexts v0.0.4-0.20241208034254-a127d64fc38a/go.mod h1:mqbY/AmvM5uyoITd6+Qtq5gchqwCaIn5pqgbH7v/DeA=
github.com/strowk/foxy-contexts v0.0.4-0.20241208035607-078a2e5414fd h1:fuOaVpR5g7lejUtcEPfSWaLZEo9VPh0JCe3o4588Jxs=
github.com/strowk/foxy-contexts v0.0.4-0.20241208035607-078a2e5414fd/go.mod h1:mqbY/AmvM5uyoITd6+Qtq5gchqwCaIn5pqgbH7v/DeA=
github.com/strowk/foxy-contexts v0.0.4-0.20241208040801-98ae5bd5e918 h1:6zQCEawu+1dpgRusOxeYnKgCniTMB3Z6jimA0xMD2e4=
github.com/strowk/foxy-contexts v0.0.4-0.20241208040801-98ae5bd5e918/go.mod h1:mqbY/AmvM5uyoITd6+Qtq5gchqwCaIn5pqgbH7v/DeA=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down
10 changes: 9 additions & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import (
)

func TestListContexts(t *testing.T) {
if os.Getenv("CI") != "" {
t.Skip("Skipping k3d tests in CI for now")
}
ts, err := foxytest.Read("testdata/k8s_contexts")
if err != nil {
t.Fatal(err)
Expand All @@ -31,6 +34,7 @@ func TestListTools(t *testing.T) {
if err != nil {
t.Fatal(err)
}
ts.WithLogging()
ts.WithExecutable("go", []string{"run", "main.go"})
cntrl := foxytest.NewTestRunner(t)
ts.Run(cntrl)
Expand All @@ -43,6 +47,7 @@ func TestInK3dCluster(t *testing.T) {
if os.Getenv("CI") != "" {
t.Skip("Skipping k3d tests in CI for now")
}

ts, err := foxytest.Read("testdata/with_k3d")
if err != nil {
t.Fatal(err)
Expand All @@ -67,7 +72,10 @@ func withK3dCluster(t *testing.T, name string, fn func()) {
t.Helper()
cmd := exec.Command("k3d", "cluster", "delete", name)
cmd.Stderr = os.Stderr
cmd.Run() // precleanup if cluster has leaked from previous test
err := cmd.Run() // precleanup if cluster has leaked from previous test
if err != nil {
t.Logf("error in preclean: %v", err)
}

defer deleteK3dCluster(t, name)

Expand Down

0 comments on commit 5fc67f7

Please sign in to comment.