Skip to content

Commit

Permalink
Update testenvs (#450)
Browse files Browse the repository at this point in the history
* new protocol release dance

* update test envs to be Nairobi and Oxford. make the tests work on both

* remove debug to stdout
  • Loading branch information
stephengaudet committed Sep 15, 2023
1 parent b6d5be8 commit a70c527
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
7 changes: 5 additions & 2 deletions integration_test/.env.current
Original file line number Diff line number Diff line change
@@ -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
7 changes: 5 additions & 2 deletions integration_test/.env.next
Original file line number Diff line number Diff line change
@@ -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
21 changes: 18 additions & 3 deletions integration_test/operationkinds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package integrationtest

import (
"log"
"os"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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...)
Expand Down Expand Up @@ -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)
})
Expand Down
2 changes: 0 additions & 2 deletions integration_test/speculos.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package integrationtest
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"strings"
Expand Down Expand Up @@ -61,7 +60,6 @@ func getScreenText() string {
if err != nil {
panic(err)
}
fmt.Println(string(bytes))
return string(bytes)
}

Expand Down

0 comments on commit a70c527

Please sign in to comment.