-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changes to integration test workflow plus new integration tests (usin…
…g flextesa) (#350) * sg-flextesa remove use of build tag to filter unit test run * sg-flextesa remove the tests being replaced * sg-flextesa add new integration tests * sg-flextesa missed a file - removing build tag filter from unit tests * sg-flextesa add new tests * sg-flextesa attempt to get workflow to trigger * sg-flextesa attempt to get workflow to trigger * sg-flextesa move integration test workflow into build and test workflow * sg-flextesa add docker login step to integration tests job * sg-flextesa correct path * sg-flextesa add debug, remove log.Fatal * sg-flextesa add more debug * sg-flextesa problems writing files - add a hacky chown to octez container * sg-flextesa wrestle file permissions in octez container * sg-flextesa add env var to kill step * sg-flextesa make integration test job depend on publish job. refactor an env var * Update operationkinds_test.go fix typo in comment
- Loading branch information
1 parent
29ce81a
commit fb32a2c
Showing
30 changed files
with
596 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
//go:build !integration | ||
|
||
package server_test | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ "base_dir": "/home/tezos/.tezos-client", | ||
"endpoint": "http://flextesa:20000", "web_port": 8080, "confirmations": 0 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[ { "name": "alice", "value": "tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb" }, | ||
{ "name": "bob", "value": "tz1aSkwEot3L2kmUvcoxzjMomb9mvBNuzFK6" }, | ||
{ "name": "opstest", "value": "tz1RKGhRF4TZNCXEfwyqZshGsVfrZeVU446B" }, | ||
{ "name": "opstest1", "value": "tz1R8HJMzVdZ9RqLCknxeq9w5rSbiqJ41szi" } ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[ { "name": "alice", | ||
"value": | ||
{ "locator": | ||
"http://signatory:6732/tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb", | ||
"key": "edpkvGfYw3LyB1UcCahKQk4rF2tvbMUk8GFiTuMjL75uGXrpvKXhjn" } }, | ||
{ "name": "bob", | ||
"value": | ||
{ "locator": | ||
"http://signatory:6732/tz1aSkwEot3L2kmUvcoxzjMomb9mvBNuzFK6", | ||
"key": "edpkurPsQ8eUApnLUJ9ZPDvu98E8VNj4KtJa1aZr16Cr5ow5VHKnz4" } }, | ||
{ "name": "opstest", | ||
"value": | ||
{ "locator": | ||
"http://signatory:6732/tz1RKGhRF4TZNCXEfwyqZshGsVfrZeVU446B", | ||
"key": "edpkvSkEEfVMKvAv87env4kMNwLfuLYe7y7wXqgfvrwJwhJJpmL1GB" } }, | ||
{ "name": "opstest1", | ||
"value": | ||
{ "locator": | ||
"http://signatory:6732/tz1R8HJMzVdZ9RqLCknxeq9w5rSbiqJ41szi", | ||
"key": "edpktfLxRbpLeFjL49Rz2xtBwPaSfdZ7ZL6W3idm2JaMTP93RwmCdo" } } ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ { "name": "alice", | ||
"value": "http://signatory:6732/tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb" }, | ||
{ "name": "bob", | ||
"value": "http://signatory:6732/tz1aSkwEot3L2kmUvcoxzjMomb9mvBNuzFK6" }, | ||
{ "name": "opstest", | ||
"value": "http://signatory:6732/tz1RKGhRF4TZNCXEfwyqZshGsVfrZeVU446B" }, | ||
{ "name": "opstest1", | ||
"value": "http://signatory:6732/tz1R8HJMzVdZ9RqLCknxeq9w5rSbiqJ41szi" } ] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package integrationtest | ||
|
||
import ( | ||
"log" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestAuthorizedKeys(t *testing.T) { | ||
var c Config | ||
c.Read("signatory.yaml") | ||
c.Server.Keys = []string{"edpkujLb5ZCZ2gprnRzE9aVHKZfx9A8EtWu2xxkwYSjBUJbesJ9rWE"} | ||
backup_then_update_config(c) | ||
defer restore_config() | ||
restart_signatory() | ||
|
||
out, err := OctezClient("-w", "1", "transfer", "1", "from", "alice", "to", "bob") | ||
require.NotNil(t, err) | ||
require.Contains(t, string(out), "remote signer expects authentication signature, but no authorized key was found in the wallet") | ||
|
||
out, err = OctezClient("import", "secret", "key", "auth", "unencrypted:edsk3ZAm9nqEo7qNugo2wcmxWnbDe7oUUmHt5UJYDdqwucsaHTAsVQ", "--force") | ||
defer OctezClient("forget", "address", "auth", "--force") | ||
if err != nil { | ||
log.Println("failed to import auth key: " + err.Error() + string(out)) | ||
} | ||
require.Nil(t, err) | ||
|
||
out, err = OctezClient("-w", "1", "transfer", "1", "from", "alice", "to", "bob") | ||
require.Nil(t, err) | ||
require.Contains(t, string(out), "Operation successfully injected in the node.") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package integrationtest | ||
|
||
import ( | ||
"log" | ||
"os" | ||
|
||
yaml "gopkg.in/yaml.v3" | ||
) | ||
|
||
type Config struct { | ||
Server ServerConfig `yaml:"server"` | ||
Vaults map[string]*VaultConfig `yaml:"vaults"` | ||
Tezos TezosConfig `yaml:"tezos"` | ||
} | ||
|
||
type ServerConfig struct { | ||
Address string `yaml:"address"` | ||
UtilityAddress string `yaml:"utility_address"` | ||
Keys []string `yaml:"authorized_keys,omitempty"` | ||
} | ||
|
||
type TezosConfig = map[string]*TezosPolicy | ||
|
||
type TezosPolicy struct { | ||
Allow map[string][]string `yaml:"allow"` | ||
LogPayloads bool `yaml:"log_payloads"` | ||
} | ||
|
||
type VaultConfig struct { | ||
Driver string `yaml:"driver"` | ||
Conf map[string]*string `yaml:"config"` | ||
} | ||
|
||
type FileVault struct { | ||
File string `yaml:"file"` | ||
} | ||
|
||
func (c *Config) Read(file string) error { | ||
yamlFile, err := os.ReadFile(file) | ||
if err != nil { | ||
return err | ||
} | ||
if err = yaml.Unmarshal(yamlFile, c); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (c *Config) Write(file string) error { | ||
yamlFile, err := yaml.Marshal(c) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
if err = os.WriteFile(file, yamlFile, 0644); err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ parameter unit ; | ||
storage unit ; | ||
code { DROP ; | ||
UNIT ; | ||
PUSH nat 10 ; | ||
LEFT string ; | ||
EMIT %event ; | ||
PUSH string "lorem ipsum" ; | ||
RIGHT nat ; | ||
EMIT %event (or (nat %number) (string %words)) ; | ||
NIL operation ; | ||
SWAP ; | ||
CONS ; | ||
SWAP ; | ||
CONS ; | ||
PAIR } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
version: "3.9" | ||
networks: | ||
ecadnet: {} | ||
services: | ||
|
||
flextesa: | ||
container_name: flextesa | ||
image: oxheadalpha/flextesa:latest | ||
ports: | ||
- "20000:20000" | ||
- "20001:20001" | ||
networks: | ||
- ecadnet | ||
volumes: | ||
- ./flextesa.sh:/usr/bin/sigybox | ||
environment: | ||
- block_time=3 | ||
command: sigybox | ||
healthcheck: | ||
test: "curl --fail http://localhost:20000/chains/main/blocks/head/header || exit 1" | ||
interval: 1s | ||
timeout: 1s | ||
retries: 10 | ||
start_period: 1s | ||
|
||
octez: | ||
container_name: octez | ||
image: tezos/tezos:$OCTEZ_VERSION | ||
networks: | ||
- ecadnet | ||
entrypoint: tail -f /dev/null | ||
volumes: | ||
- ./.tezos-client:/home/tezos/.tezos-client | ||
- ./contract.event.tz:/home/tezos/contract.event.tz | ||
depends_on: | ||
flextesa: | ||
condition: service_healthy | ||
signatory: | ||
condition: service_healthy | ||
healthcheck: | ||
test: ["CMD", "octez-client", "list", "known", "addresses"] | ||
interval: 1s | ||
timeout: 1s | ||
retries: 10 | ||
start_period: 1s | ||
|
||
signatory: | ||
container_name: signatory | ||
image: $IMAGE | ||
ports: | ||
- "6732:6732" | ||
- "9583:9583" | ||
networks: | ||
- ecadnet | ||
configs: | ||
- source: sigy-config | ||
target: /etc/signatory.yaml | ||
- source: sigy-secret | ||
target: /etc/secret.json | ||
command: serve | ||
healthcheck: | ||
test: "curl --fail http://localhost:6732/authorized_keys || exit 1" | ||
interval: 1s | ||
timeout: 1s | ||
retries: 10 | ||
start_period: 1s | ||
|
||
configs: | ||
sigy-config: | ||
file: ./signatory.yaml | ||
sigy-secret: | ||
file: ./signatory-local-secret.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#! /bin/sh | ||
|
||
protocol=Mumbai | ||
time_bb=${block_time:-1} | ||
|
||
|
||
export alice="$(flextesa key alice)" | ||
export bob="$(flextesa key bob)" | ||
export speculos="speculos,edpktsKqhvR7kXbRWD7yDgLSD7PZUXvjLqf9SFscXhL52pUStF5nQp,tz1RVYaHiobUKXMfJ47F7Rjxx5tu3LC35WSA,unencrypted:edskRuZGqmXodGDghUhpHV5mfcmfEpA46FLs5kY6QBbyzpfb9JQEwpvrumBroTJ9iyHcY8PKdRAusCLPf7vDRVXhfN8WHE5r8m" | ||
export b0="$(flextesa key bootacc-0)" | ||
export user1="user1,edpkvNSVE2pL4eaCYrew1NEuLi4nnYmwQfe4tdM4NoVgNMEoVCNGoW,tz1QgHGuotVTCmYtA2Mr83FdiWLbwKqUvdnp,unencrypted:edsk3bNBh8s1eovydiRv6YitZHQpBkcS9s9ATQHRZfUQxUKcFU9Mh7" | ||
|
||
root_path=/tmp/mini-box | ||
|
||
flextesa mini-net \ | ||
--root "$root_path" --size 1 "$@" \ | ||
--set-history-mode N000:archive \ | ||
--number-of-b 1 \ | ||
--balance-of-bootstrap-accounts tez:100_000_000 \ | ||
--time-b "$time_bb" \ | ||
--add-bootstrap-account="$alice@2_000_000_000_000" \ | ||
--add-bootstrap-account="$speculos@2_000_000_000_000" \ | ||
--add-bootstrap-account="$bob@2_000_000_000_000" \ | ||
--add-bootstrap-account="$user1@2_000_000_000_000" \ | ||
--no-daemons-for=alice \ | ||
--no-daemons-for=bob \ | ||
--no-daemons-for=speculos \ | ||
--no-daemons-for=user1 \ | ||
--until-level 200_000_000 \ | ||
--protocol-kind "$protocol" |
Oops, something went wrong.