Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update testenvs #450

Merged
merged 6 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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