generated from pulumi/pulumi-provider-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow opt-out of adding stdout/stderr env variables for remote command (
#451) # Context At the moment, stdout and stderr of previous runs are passed as environment variables on future invocations. When stdout or stderr is too large, this cause an error. # Proposed change #355 fixed it for local commands, this fixed it for remote commands. See #285 for full details on the issue See this comment for details around local vs remote functionality : #285 (comment) --------- Co-authored-by: Thomas Kappler <[email protected]> Co-authored-by: Martin Lehmann <[email protected]>
- Loading branch information
1 parent
d7a0988
commit fc0d188
Showing
12 changed files
with
347 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package testutil | ||
|
||
import ( | ||
"fmt" | ||
"net" | ||
"strconv" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/gliderlabs/ssh" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
type TestSshServer struct { | ||
Host string | ||
Port int64 | ||
} | ||
|
||
// NewTestSshServer creates a new in-process SSH server with the specified handler. | ||
// The server is bound to an arbitrary free port, and automatically closed | ||
// during test cleanup. | ||
func NewTestSshServer(t *testing.T, handler ssh.Handler) TestSshServer { | ||
const host = "127.0.0.1" | ||
|
||
listener, err := net.Listen("tcp", fmt.Sprintf("%s:%d", host, 0)) | ||
require.NoErrorf(t, err, "net.Listen()") | ||
|
||
port, err := strconv.ParseInt(strings.Split(listener.Addr().String(), ":")[1], 10, 64) | ||
require.NoErrorf(t, err, "parse address %s allocated port number as int", listener.Addr()) | ||
|
||
server := ssh.Server{Handler: handler} | ||
go func() { | ||
// "Serve always returns a non-nil error." | ||
_ = server.Serve(listener) | ||
}() | ||
t.Cleanup(func() { | ||
_ = server.Close() | ||
}) | ||
|
||
return TestSshServer{ | ||
Host: host, | ||
Port: port, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.