| 1 | package main_testscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/" |
| 5 | "ioscip-go gomod github.com/golang/go/src go1.24.2 io/" |
| 6 | "netscip-go gomod github.com/golang/go/src go1.24.2 net/" |
| 7 | "os/execscip-go gomod github.com/golang/go/src go1.24.2 `os/exec`/" |
| 8 | "stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/" |
| 9 | |
| 10 | . "github.com/onsi/ginkgo/v2scip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/" |
| 11 | . "github.com/onsi/gomegascip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/" |
| 12 | "github.com/onsi/gomega/gbytesscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gbytes`/" |
| 13 | "github.com/onsi/gomega/gexecscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/" |
| 14 | ) |
| 15 | |
| 16 | var serverBinaryPathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/serverBinaryPath., clientBinaryPathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/clientBinaryPath. string |
| 17 | |
| 18 | var _ = SynchronizedBeforeSuitescip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/SynchronizedBeforeSuite().(func() []byte { |
| 19 | serverBinaryPath, err := gexecscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/.Buildscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/Build().("github.com/containernetworking/plugins/pkg/testutils/echo/server") |
| 20 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 21 | clientBinaryPath, err := gexecscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/.Buildscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/Build().("github.com/containernetworking/plugins/pkg/testutils/echo/client") |
| 22 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 23 | return []byte(stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.Joinscip-go gomod github.com/golang/go/src go1.24.2 strings/Join().([]string{serverBinaryPath, clientBinaryPath}, ",")) |
| 24 | }, func(datascip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/_:data. []byte) { |
| 25 | binaries := stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.Splitscip-go gomod github.com/golang/go/src go1.24.2 strings/Split().(string(datascip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/_:data.), ",") |
| 26 | serverBinaryPathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/serverBinaryPath. = binaries[0] |
| 27 | clientBinaryPathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/clientBinaryPath. = binaries[1] |
| 28 | }) |
| 29 | |
| 30 | var _ = SynchronizedAfterSuitescip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/SynchronizedAfterSuite().(func() {}, func() { |
| 31 | gexecscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/.CleanupBuildArtifactsscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/CleanupBuildArtifacts().() |
| 32 | }) |
| 33 | |
| 34 | var _ = Describescip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Describe().("Echosvr", func() { |
| 35 | var sessionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/_:session. *gexecscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/.Sessionscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/Session# |
| 36 | BeforeEachscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/BeforeEach().(func() { |
| 37 | var errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/_:err. error |
| 38 | cmd := execscip-go gomod github.com/golang/go/src go1.24.2 `os/exec`/.Commandscip-go gomod github.com/golang/go/src go1.24.2 `os/exec`/Command().(serverBinaryPathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/serverBinaryPath.) |
| 39 | sessionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/_:session., errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/_:err. = gexecscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/.Startscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/Start().(cmd, GinkgoWriterscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoWriter., GinkgoWriterscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoWriter.) |
| 40 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(errscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/_:err.).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 41 | }) |
| 42 | |
| 43 | AfterEachscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/AfterEach().(func() { |
| 44 | sessionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/_:session..Killscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/Session#Kill().().Waitscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/Session#Wait().() |
| 45 | }) |
| 46 | |
| 47 | Contextscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Context.("Server test", func() { |
| 48 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("starts and doesn't terminate immediately", func() { |
| 49 | Consistentlyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Consistently().(sessionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/_:session.).ShouldNotscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/AsyncAssertion#ShouldNot().(gexecscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/.Exitscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/Exit().()) |
| 50 | }) |
| 51 | |
| 52 | tryConnect := func() (netscip-go gomod github.com/golang/go/src go1.24.2 net/.Connscip-go gomod github.com/golang/go/src go1.24.2 net/Conn#, error) { |
| 53 | programOutput := sessionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/_:session..Outscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/Session#Out..Contentsscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gbytes`/Buffer#Contents().() |
| 54 | addr := stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.TrimSpacescip-go gomod github.com/golang/go/src go1.24.2 strings/TrimSpace().(string(programOutput)) |
| 55 | |
| 56 | conn, err := netscip-go gomod github.com/golang/go/src go1.24.2 net/.Dialscip-go gomod github.com/golang/go/src go1.24.2 net/Dial().("tcp", addr) |
| 57 | if err != nil { |
| 58 | return nil, err |
| 59 | } |
| 60 | return conn, err |
| 61 | } |
| 62 | |
| 63 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("prints its listening address to stdout", func() { |
| 64 | Eventuallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Eventually().(sessionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/_:session..Outscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/Session#Out.).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/AsyncAssertion#Should().(gbytesscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gbytes`/.Sayscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gbytes`/Say().("\n")) |
| 65 | conn, err := tryConnect() |
| 66 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 67 | conn.Closescip-go gomod github.com/golang/go/src go1.24.2 net/Conn#Close().() |
| 68 | }) |
| 69 | |
| 70 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("will echo data back to us", func() { |
| 71 | Eventuallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Eventually().(sessionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/_:session..Outscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/Session#Out.).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/AsyncAssertion#Should().(gbytesscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gbytes`/.Sayscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gbytes`/Say().("\n")) |
| 72 | conn, err := tryConnect() |
| 73 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 74 | defer conn.Closescip-go gomod github.com/golang/go/src go1.24.2 net/Conn#Close().() |
| 75 | |
| 76 | fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24.2 fmt/Fprintf().(conn, "hello\n") |
| 77 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(ioscip-go gomod github.com/golang/go/src go1.24.2 io/.ReadAllscip-go gomod github.com/golang/go/src go1.24.2 io/ReadAll().(conn)).Toscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#To().(Equalscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Equal().([]byte("hello"))) |
| 78 | }) |
| 79 | }) |
| 80 | |
| 81 | Contextscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/Context.("Client Server Test", func() { |
| 82 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("starts and doesn't terminate immediately", func() { |
| 83 | Consistentlyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Consistently().(sessionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/_:session.).ShouldNotscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/AsyncAssertion#ShouldNot().(gexecscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/.Exitscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/Exit().()) |
| 84 | }) |
| 85 | |
| 86 | Itscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/It().("connects successfully using echo client", func() { |
| 87 | Eventuallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Eventually().(sessionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/_:session..Outscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/Session#Out.).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/AsyncAssertion#Should().(gbytesscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gbytes`/.Sayscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gbytes`/Say().("\n")) |
| 88 | serverAddress := stringsscip-go gomod github.com/golang/go/src go1.24.2 strings/.TrimSpacescip-go gomod github.com/golang/go/src go1.24.2 strings/TrimSpace().(string(sessionscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/_:session..Outscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/Session#Out..Contentsscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gbytes`/Buffer#Contents().())) |
| 89 | fmtscip-go gomod github.com/golang/go/src go1.24.2 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.24.2 fmt/Println().("Server address", serverAddress) |
| 90 | |
| 91 | cmd := execscip-go gomod github.com/golang/go/src go1.24.2 `os/exec`/.Commandscip-go gomod github.com/golang/go/src go1.24.2 `os/exec`/Command().(clientBinaryPathscip-go gomod github.com/containernetworking/plugins . `github.com/containernetworking/plugins/pkg/testutils/echo_test`/clientBinaryPath., "-target", serverAddress, "-message", "hello") |
| 92 | clientSession, err := gexecscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/.Startscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/Start().(cmd, GinkgoWriterscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoWriter., GinkgoWriterscip-go gomod github.com/onsi/ginkgo/v2 v2.25.1 `github.com/onsi/ginkgo/v2`/GinkgoWriter.) |
| 93 | Expectscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(HaveOccurredscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 94 | Eventuallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Eventually().(clientSession.Outscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/Session#Out.).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/AsyncAssertion#Should().(gbytesscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gbytes`/.Sayscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gbytes`/Say().("hello")) |
| 95 | Eventuallyscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega`/Eventually().(clientSession).Shouldscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/types`/AsyncAssertion#Should().(gexecscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/.Exitscip-go gomod github.com/onsi/gomega v1.38.1 `github.com/onsi/gomega/gexec`/Exit().()) |
| 96 | }) |
| 97 | }) |
| 98 | }) |