Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cardil committed Mar 26, 2024
1 parent c7f14d8 commit 51e871a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
2 changes: 2 additions & 0 deletions go.mod
Expand Up @@ -200,3 +200,5 @@ require (
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace knative.dev/client-pkg => github.com/cardil/knative-client-pkg v0.0.0-20240326105146-5b4166833df6

Check failure on line 204 in go.mod

View workflow job for this annotation

GitHub Actions / Golangci

replacement are not allowed: knative.dev/client-pkg (gomoddirectives)
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -116,6 +116,8 @@ github.com/bodgit/windows v1.0.1 h1:tF7K6KOluPYygXa3Z2594zxlkbKPAOvqr97etrGNIz4=
github.com/bodgit/windows v1.0.1/go.mod h1:a6JLwrB4KrTR5hBpp8FI9/9W9jJfeQ2h4XDXU74ZCdM=
github.com/cardil/ghet v0.0.1-0.20240322174403-1901c4fe21ac h1:J6clysTPmIXMLYNh5Vu+x3qNiMTXKibibYz4dO/tiT8=
github.com/cardil/ghet v0.0.1-0.20240322174403-1901c4fe21ac/go.mod h1:INmHFxuHn5LmjkjmR9aCqa6msghwM/4q5He/vYlucfY=
github.com/cardil/knative-client-pkg v0.0.0-20240326105146-5b4166833df6 h1:bFySvR7D6LHZKPNtsrQruDqBZw6VQb6fQ+a/6PCVvpg=
github.com/cardil/knative-client-pkg v0.0.0-20240326105146-5b4166833df6/go.mod h1:+wx9/SVVGLte1JRcULet7kKnnUmgPzG1vQpD8E4DwVs=
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
Expand Down Expand Up @@ -799,8 +801,6 @@ k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw=
k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 h1:gbqbevonBh57eILzModw6mrkbwM0gQBEuevE/AaBsHY=
k8s.io/utils v0.0.0-20240310230437-4693a0247e57/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
knative.dev/client-pkg v0.0.0-20240322171749-cf1573f93631 h1:LRwjoTbqyruGECvQZyGQE3k5clxwmgCQEt5HcWTUz2Y=
knative.dev/client-pkg v0.0.0-20240322171749-cf1573f93631/go.mod h1:CODwMfQexBzzgB2fv9hYF1+FZfrYc9TF3B26GxW69zQ=
knative.dev/pkg v0.0.0-20240318073042-db6f3b074e8c h1:d8GmDhObjnH/iKrazsNjgLuuEnxLiFE/QSaeFY337cw=
knative.dev/pkg v0.0.0-20240318073042-db6f3b074e8c/go.mod h1:RfDXq7Rf7UmGCEdAiJZPpBRuh7dX73T8clniFt2zEAA=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
Expand Down
30 changes: 23 additions & 7 deletions tests/project_build_test.go
Expand Up @@ -17,25 +17,41 @@ func TestProjectBuild(t *testing.T) {
if testing.Short() {
t.Skip("short tests only")
}
execCmd(t, "./example", "./mage", "clean", "build")
execCmd(t, "./example/build/_output/bin", fmt.Sprintf("./other-%s-%s",
runtime.GOOS, runtime.GOARCH))
c := mkCmd("./example", "./mage", "clean", "build")
assertCommandStarted(t, c)
assertCommandSucceded(t, c)
c = mkCmd("./example/build/_output/bin",
fmt.Sprintf("./other-%s-%s", runtime.GOOS, runtime.GOARCH))
assertCommandStarted(t, c)
assertCommandSucceded(t, c)
}

func execCmd(tb testing.TB, dir, name string, args ...string) {
tb.Helper()
func mkCmd(dir, name string, args ...string) *exec.Cmd {
c := exec.Command(name, args...)
c.Env = append(
env(filterOutByName{names: []string{"GOOS"}}),
env(filterOutByName{names: []string{"GOOS", "GOARCH", "GOARM"}}),
"GOTRACEBACK=all",
)
c.Dir = dir
c.Stdout = os.Stdout
c.Stderr = os.Stderr
return c
}

func assertCommandStarted(tb testing.TB, c *exec.Cmd) {
tb.Helper()
assert.NilError(tb, c.Start())
tb.Logf("Started `%q` with pid %d",
append([]string{name}, args...),
append([]string{c.Path}, c.Args...),
c.Process.Pid)
tb.Log("Process env:")
for _, e := range c.Env {
tb.Logf(" * %s", e)
}
}

func assertCommandSucceded(tb testing.TB, c *exec.Cmd) {
tb.Helper()
assert.NilError(tb, c.Wait())
}

Expand Down

0 comments on commit 51e871a

Please sign in to comment.