From caa75ae791488172a35e740b13c43de7c7c7e41d Mon Sep 17 00:00:00 2001 From: William Banfield Date: Mon, 24 Oct 2022 11:44:32 -0400 Subject: [PATCH] use manifest instead of file in all places --- test/e2e/pkg/testnet.go | 10 +++------- test/e2e/runner/main.go | 2 +- test/e2e/tests/e2e_test.go | 16 ++++++++-------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/test/e2e/pkg/testnet.go b/test/e2e/pkg/testnet.go index d0cb4aac4..58c336dfa 100644 --- a/test/e2e/pkg/testnet.go +++ b/test/e2e/pkg/testnet.go @@ -103,12 +103,8 @@ type Node struct { // The testnet generation must be deterministic, since it is generated // separately by the runner and the test cases. For this reason, testnets use a // random seed to generate e.g. keys. -func LoadTestnet(file string, ifd InfrastructureData) (*Testnet, error) { - manifest, err := LoadManifest(file) - if err != nil { - return nil, err - } - dir := strings.TrimSuffix(file, filepath.Ext(file)) +func LoadTestnet(manifest Manifest, fname string, ifd InfrastructureData) (*Testnet, error) { + dir := strings.TrimSuffix(fname, filepath.Ext(fname)) // Set up resource generators. These must be deterministic. var netAddress string @@ -137,7 +133,7 @@ func LoadTestnet(file string, ifd InfrastructureData) (*Testnet, error) { testnet := &Testnet{ Name: filepath.Base(dir), - File: file, + File: fname, Dir: dir, IP: ipGen.Network(), InitialHeight: 1, diff --git a/test/e2e/runner/main.go b/test/e2e/runner/main.go index 4f56a9e24..69e9360a3 100644 --- a/test/e2e/runner/main.go +++ b/test/e2e/runner/main.go @@ -79,7 +79,7 @@ func NewCLI() *CLI { return fmt.Errorf("unknown infrastructure type '%s'", inft) } - testnet, err := e2e.LoadTestnet(file, ifd) + testnet, err := e2e.LoadTestnet(m, file, ifd) if err != nil { return err } diff --git a/test/e2e/tests/e2e_test.go b/test/e2e/tests/e2e_test.go index 63ef6cb29..5df3309d4 100644 --- a/test/e2e/tests/e2e_test.go +++ b/test/e2e/tests/e2e_test.go @@ -66,27 +66,27 @@ func testNode(t *testing.T, testFunc func(*testing.T, e2e.Node)) { func loadTestnet(t *testing.T) e2e.Testnet { t.Helper() - manifest := os.Getenv("E2E_MANIFEST") - if manifest == "" { + manifestFile := os.Getenv("E2E_MANIFEST") + if manifestFile == "" { t.Skip("E2E_MANIFEST not set, not an end-to-end test run") } - if !filepath.IsAbs(manifest) { - manifest = filepath.Join("..", manifest) + if !filepath.IsAbs(manifestFile) { + manifestFile = filepath.Join("..", manifestFile) } testnetCacheMtx.Lock() defer testnetCacheMtx.Unlock() - if testnet, ok := testnetCache[manifest]; ok { + if testnet, ok := testnetCache[manifestFile]; ok { return testnet } - m, err := e2e.LoadManifest(manifest) + m, err := e2e.LoadManifest(manifestFile) require.NoError(t, err) ifd, err := e2e.NewDockerInfrastructureData(m) require.NoError(t, err) - testnet, err := e2e.LoadTestnet(manifest, ifd) + testnet, err := e2e.LoadTestnet(m, manifestFile, ifd) require.NoError(t, err) - testnetCache[manifest] = *testnet + testnetCache[manifestFile] = *testnet return *testnet }