diff --git a/go.mod b/go.mod index 2f06e04cb3d2..b25b720f66f0 100644 --- a/go.mod +++ b/go.mod @@ -154,4 +154,4 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect ) -replace knative.dev/pkg => github.com/mgencur/pkg v0.0.0-20231010091720-974d18ba37f9 +replace knative.dev/pkg => github.com/mgencur/pkg v0.0.0-20231011054611-64dda1efdfa8 diff --git a/go.sum b/go.sum index a74d03465bdf..17b1834fbe69 100644 --- a/go.sum +++ b/go.sum @@ -382,8 +382,8 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/mgencur/pkg v0.0.0-20231010091720-974d18ba37f9 h1:u81aWjeVcnmXB5YJ8Z6/c24lvC9ozXJdsh/Og87jm/o= -github.com/mgencur/pkg v0.0.0-20231010091720-974d18ba37f9/go.mod h1:PxnS8ZnVtC0S+An+NEhrpzWt6k9hedDNt659Gu5EtJk= +github.com/mgencur/pkg v0.0.0-20231011054611-64dda1efdfa8 h1:uEpGV3JOo6uQqtKdRvfJbzKhBdry2bANQBjWctri1QE= +github.com/mgencur/pkg v0.0.0-20231011054611-64dda1efdfa8/go.mod h1:PxnS8ZnVtC0S+An+NEhrpzWt6k9hedDNt659Gu5EtJk= github.com/miekg/dns v1.1.55 h1:GoQ4hpsj0nFLYe+bWiCToyrBEJXkQfOOIvFGFy0lEgo= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= diff --git a/vendor/knative.dev/pkg/test/shell/executor.go b/vendor/knative.dev/pkg/test/shell/executor.go index 04c76401c4d0..f347321ad715 100644 --- a/vendor/knative.dev/pkg/test/shell/executor.go +++ b/vendor/knative.dev/pkg/test/shell/executor.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - https://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -23,7 +23,6 @@ import ( "os" "os/exec" "strings" - "testing" "time" ) @@ -46,10 +45,11 @@ func NewExecutor(config ExecutorConfig) Executor { // TestingTStreams returns Streams which writes to t.Log and marks // the test as failed if anything is written to Streams.Err. -func TestingTStreams(t testing.TB) Streams { +func TestingTStreams(t TestingT) Streams { + tWriter := testingWriter{t: t} return Streams{ - Out: testingWriter{t: t}, - Err: testingWriter{t: t, markFailed: true}, + Out: tWriter, + Err: tWriter, } } @@ -160,10 +160,10 @@ func withTempScript(contents string, fn func(bin string) error) error { if err != nil { return err } - //defer func() { - // // clean up - // _ = os.Remove(tmpfile.Name()) - //}() + defer func() { + // clean up + _ = os.Remove(tmpfile.Name()) + }() return fn(tmpfile.Name()) } @@ -205,9 +205,6 @@ func (w testingWriter) Write(p []byte) (n int, err error) { p = bytes.TrimRight(p, "\n") w.t.Logf("%s", p) - if w.markFailed { - w.t.Fail() - } return n, nil } diff --git a/vendor/knative.dev/pkg/test/shell/fail-example.sh b/vendor/knative.dev/pkg/test/shell/fail-example.sh index 551ce662a340..4815aef9de1a 100644 --- a/vendor/knative.dev/pkg/test/shell/fail-example.sh +++ b/vendor/knative.dev/pkg/test/shell/fail-example.sh @@ -6,7 +6,7 @@ # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# https://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, diff --git a/vendor/knative.dev/pkg/test/shell/prefixer.go b/vendor/knative.dev/pkg/test/shell/prefixer.go index 273ee1cc4fff..f267c1e3b42f 100644 --- a/vendor/knative.dev/pkg/test/shell/prefixer.go +++ b/vendor/knative.dev/pkg/test/shell/prefixer.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - https://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/vendor/knative.dev/pkg/test/shell/project.go b/vendor/knative.dev/pkg/test/shell/project.go index 498cc3490373..2d5ded547c70 100644 --- a/vendor/knative.dev/pkg/test/shell/project.go +++ b/vendor/knative.dev/pkg/test/shell/project.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - https://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/vendor/knative.dev/pkg/test/shell/types.go b/vendor/knative.dev/pkg/test/shell/types.go index 58aa745e23e3..36e9af3af977 100644 --- a/vendor/knative.dev/pkg/test/shell/types.go +++ b/vendor/knative.dev/pkg/test/shell/types.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - https://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -18,7 +18,6 @@ package shell import ( "io" - "testing" ) // ProjectLocation represents a project location on a file system. @@ -47,13 +46,14 @@ type ExecutorConfig struct { Environ []string } +// TestingT is used by testingWriter and allows passing testing.T. +type TestingT interface { + Logf(args ...any) +} + // testingWriter writes to the given testing.TB. type testingWriter struct { - t testing.TB - - // If true, the test will be marked as failed if this testingWriter is - // ever used. - markFailed bool + t TestingT } // StreamType represets either output or error stream. diff --git a/vendor/modules.txt b/vendor/modules.txt index b33f2906eb1a..4fc00e0983e8 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1470,4 +1470,4 @@ sigs.k8s.io/structured-merge-diff/v4/value # sigs.k8s.io/yaml v1.3.0 ## explicit; go 1.12 sigs.k8s.io/yaml -# knative.dev/pkg => github.com/mgencur/pkg v0.0.0-20231010091720-974d18ba37f9 +# knative.dev/pkg => github.com/mgencur/pkg v0.0.0-20231011054611-64dda1efdfa8