Skip to content

Commit

Permalink
Merge branch 'main' into enhancement/multistage-build
Browse files Browse the repository at this point in the history
  • Loading branch information
denisandreenko committed Sep 18, 2023
2 parents d60e30b + a70c527 commit 3ba245f
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 17 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
16 changes: 8 additions & 8 deletions integration_test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ services:
command: sigybox $PROTOCOL
healthcheck:
test: "curl --fail http://localhost:20000/chains/main/blocks/head/header || exit 1"
interval: 1s
timeout: 1s
retries: 10
start_period: 1s
interval: 10s
timeout: 10s
retries: 20
start_period: 10s

flextesanobaking:
container_name: flextesanobaking
Expand All @@ -38,10 +38,10 @@ services:
command: sigybox $PROTOCOL
healthcheck:
test: "curl --fail http://localhost:20000/chains/main/blocks/head/header || exit 1"
interval: 1s
timeout: 1s
retries: 10
start_period: 1s
interval: 10s
timeout: 10s
retries: 20
start_period: 10s

octez:
container_name: octez
Expand Down
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 3ba245f

Please sign in to comment.