Skip to content

Commit

Permalink
Update knative.dev/pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
mgencur committed Oct 11, 2023
1 parent ae85908 commit 1cfa101
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 26 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
21 changes: 9 additions & 12 deletions vendor/knative.dev/pkg/test/shell/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -23,7 +23,6 @@ import (
"os"
"os/exec"
"strings"
"testing"
"time"
)

Expand All @@ -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,
}
}

Expand Down Expand Up @@ -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())
}
Expand Down Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion vendor/knative.dev/pkg/test/shell/fail-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion vendor/knative.dev/pkg/test/shell/prefixer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion vendor/knative.dev/pkg/test/shell/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 7 additions & 7 deletions vendor/knative.dev/pkg/test/shell/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -18,7 +18,6 @@ package shell

import (
"io"
"testing"
)

// ProjectLocation represents a project location on a file system.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1cfa101

Please sign in to comment.