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 6a838ac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 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-20240325183850-829d91b1b13e

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-20240325183850-829d91b1b13e h1:1YMXfzvLOJi+5N5jCqnHYAAddKnaGXvQG2rdrmodmPI=
github.com/cardil/knative-client-pkg v0.0.0-20240325183850-829d91b1b13e/go.mod h1:CODwMfQexBzzgB2fv9hYF1+FZfrYc9TF3B26GxW69zQ=
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
24 changes: 18 additions & 6 deletions tests/project_build_test.go
Expand Up @@ -17,13 +17,16 @@ 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"}}),
Expand All @@ -32,10 +35,19 @@ func execCmd(tb testing.TB, dir, name string, args ...string) {
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)
}

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

Expand Down

0 comments on commit 6a838ac

Please sign in to comment.