From a70c527c46a1c847f94c9b1454898b9b89b745ee Mon Sep 17 00:00:00 2001 From: stephengaudet <32783698+stephengaudet@users.noreply.github.com> Date: Thu, 14 Sep 2023 18:17:46 -0700 Subject: [PATCH] Update testenvs (#450) * new protocol release dance * update test envs to be Nairobi and Oxford. make the tests work on both * remove debug to stdout --- integration_test/.env.current | 7 +++++-- integration_test/.env.next | 7 +++++-- integration_test/operationkinds_test.go | 21 ++++++++++++++++++--- integration_test/speculos.go | 2 -- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/integration_test/.env.current b/integration_test/.env.current index 9b9d806e..29a7fa4b 100644 --- a/integration_test/.env.current +++ b/integration_test/.env.current @@ -1,2 +1,5 @@ -export OCTEZ_VERSION=${ARCH}_v16.1 -export PROTOCOL=Mumbai +export OCTEZ_VERSION=${ARCH}_v17.3 +export PROTOCOL=Nairobi +export SET_DEPOSITS_LIMIT=true +export ATTESTATION=endorsement +export PREATTESTATION=preendorsement diff --git a/integration_test/.env.next b/integration_test/.env.next index 776740fd..5ab96e0f 100644 --- a/integration_test/.env.next +++ b/integration_test/.env.next @@ -1,2 +1,5 @@ -export OCTEZ_VERSION=${ARCH}_v17.2 -export PROTOCOL=Nairobi +export OCTEZ_VERSION=${ARCH}_v18.0-rc1 +export PROTOCOL=Oxford +export SET_DEPOSITS_LIMIT=false +export ATTESTATION=attestation +export PREATTESTATION=preattestation diff --git a/integration_test/operationkinds_test.go b/integration_test/operationkinds_test.go index f0304108..5c89d7d9 100644 --- a/integration_test/operationkinds_test.go +++ b/integration_test/operationkinds_test.go @@ -2,6 +2,7 @@ package integrationtest import ( "log" + "os" "testing" "github.com/stretchr/testify/assert" @@ -42,7 +43,7 @@ var testcases = []testCase{ account: account, allowPolicy: map[string][]string{"generic": {"preendorsement"}, "preendorsement": {}}, notAllowPolicy: map[string][]string{"generic": getAllOpsExcluding([]string{"preendorsement"}), "endorsement": {}, "block": {}}, - successMessage: "injected preendorsement", + successMessage: "injected ", }, { kind: "endorsement", @@ -52,7 +53,7 @@ var testcases = []testCase{ account: account, allowPolicy: map[string][]string{"generic": {"endorsement"}, "endorsement": {}}, notAllowPolicy: map[string][]string{"generic": getAllOpsExcluding([]string{"endorsement"}), "preendorsement": {}, "block": {}}, - successMessage: "injected endorsement", + successMessage: "injected ", }, { kind: "block", @@ -151,6 +152,20 @@ func TestOperationAllowPolicy(t *testing.T) { defer clean_tezos_folder() for _, test := range testcases { t.Run(test.kind, func(t *testing.T) { + //while we are testing Nairobi and Oxford at the same time we have conditional for set_deposits_limit + //when we are testing O and P at the same time, we can remove this conditional and the env var + //set_deposits_limit is not a valid operation in O + if os.Getenv("SET_DEPOSITS_LIMIT") == "false" && test.kind == "set_deposits_limit" { + return + } + //likewise, when we stop testing N, we can get rid of the next 2 conditionals + if test.kind == "endorsement" { + test.successMessage = test.successMessage + os.Getenv("ATTESTATION") + } + if test.kind == "preendorsement" { + test.successMessage = test.successMessage + os.Getenv("PREATTESTATION") + } + //first, do any setup steps that have to happen before the operation to be tested for _, setupOp := range test.testSetupOps { out, err := OctezClient(setupOp...) @@ -189,7 +204,7 @@ func TestOperationAllowPolicy(t *testing.T) { log.Println("error received: " + err.Error() + " " + string(out)) } assert.NoError(t, err) - assert.Contains(t, string(out), test.successMessage) + require.Contains(t, string(out), test.successMessage) metrics2 := GetMetrics(test.account, test.kind, test.op, vault) AssertMetricsSuccessIncremented(t, metrics1, metrics2, test.op) }) diff --git a/integration_test/speculos.go b/integration_test/speculos.go index 5775ea61..1841c563 100644 --- a/integration_test/speculos.go +++ b/integration_test/speculos.go @@ -3,7 +3,6 @@ package integrationtest import ( "bytes" "encoding/json" - "fmt" "io" "net/http" "strings" @@ -61,7 +60,6 @@ func getScreenText() string { if err != nil { panic(err) } - fmt.Println(string(bytes)) return string(bytes) }