Skip to content

Commit

Permalink
Merge branch 'main' into go-upgrade-1.21.0
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengaudet committed Aug 10, 2023
2 parents 6704b0d + 1ac0b0c commit 4965e4c
Show file tree
Hide file tree
Showing 21 changed files with 325 additions and 80 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ jobs:
VAULT_AWS_KEY: ${{ secrets.INTEGRATIONTEST_VAULT_AWS_KEY }}
VAULT_AWS_SECRET: ${{ secrets.INTEGRATIONTEST_VAULT_AWS_SECRET }}
VAULT_AWS_REGION: ${{ secrets.INTEGRATIONTEST_VAULT_AWS_REGION }}
VAULT_AWS_PKH_TZ2: ${{ secrets.INTEGRATIONTEST_VAULT_AWS_TZ2 }}
VAULT_AWS_PKH_TZ3: ${{ secrets.INTEGRATIONTEST_VAULT_AWS_TZ3 }}
VAULT_AWS_TZ2: ${{ secrets.INTEGRATIONTEST_VAULT_AWS_TZ2 }}
VAULT_AWS_TZ3: ${{ secrets.INTEGRATIONTEST_VAULT_AWS_TZ3 }}
VAULT_AWS_TZ3_PK: ${{ secrets.INTEGRATIONTEST_VAULT_AWS_TZ3_PK }}
VAULT_AZ_CLIENTCERTTHUMB: ${{ secrets.INTEGRATIONTEST_VAULT_AZ_CLIENTCERTTHUMB }}
VAULT_AZ_CLIENTID: ${{ secrets.INTEGRATIONTEST_VAULT_AZ_CLIENTID }}
VAULT_AZ_RESGROUP: ${{ secrets.INTEGRATIONTEST_VAULT_AZ_RESGROUP }}
Expand All @@ -137,6 +138,7 @@ jobs:
VAULT_AZ_VAULT: ${{ secrets.INTEGRATIONTEST_VAULT_AZ_VAULT }}
VAULT_AZ_TZ2: ${{ secrets.INTEGRATIONTEST_VAULT_AZ_TZ2 }}
VAULT_AZ_TZ3: ${{ secrets.INTEGRATIONTEST_VAULT_AZ_TZ3 }}
VAULT_AZ_TZ3_PK: ${{ secrets.INTEGRATIONTEST_VAULT_AZ_TZ3_PK }}
VAULT_GCP_PROJECTID: ${{ secrets.INTEGRATIONTEST_VAULT_GCP_PROJECTID }}
VAULT_GCP_PRIVATEKEYID: ${{ secrets.INTEGRATIONTEST_VAULT_GCP_PRIVATEKEYID }}
VAULT_GCP_PRIVATEKEY: ${{ secrets.INTEGRATIONTEST_VAULT_GCP_PRIVATEKEY }}
Expand All @@ -146,6 +148,7 @@ jobs:
VAULT_GCP_KEYRING: ${{ secrets.INTEGRATIONTEST_VAULT_GCP_KEYRING }}
VAULT_GCP_LOCATION: ${{ secrets.INTEGRATIONTEST_VAULT_GCP_LOCATION }}
VAULT_GCP_TZ3: ${{ secrets.INTEGRATIONTEST_VAULT_GCP_TZ3 }}
VAULT_GCP_TZ3_PK: ${{ secrets.INTEGRATIONTEST_VAULT_GCP_TZ3_PK }}
run: >
cd integration_test;
export ARCH=amd64;
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0
github.com/ecadlabs/goblst v1.0.0
github.com/ecadlabs/gotez v1.0.0
github.com/go-playground/validator/v10 v10.14.1
github.com/go-playground/validator/v10 v10.15.0
github.com/google/tink/go v1.7.0
github.com/google/uuid v1.3.0
github.com/gorilla/mux v1.8.0
Expand All @@ -18,9 +18,9 @@ require (
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.4
golang.org/x/crypto v0.11.0
golang.org/x/crypto v0.12.0
golang.org/x/exp v0.0.0-20230420155640-133eef4313cb
golang.org/x/oauth2 v0.10.0
golang.org/x/oauth2 v0.11.0
google.golang.org/api v0.134.0
gopkg.in/yaml.v3 v3.0.1
)
Expand All @@ -42,7 +42,7 @@ require (
)

require (
github.com/aws/aws-sdk-go v1.44.305
github.com/aws/aws-sdk-go v1.44.318
github.com/beorn7/perks v1.0.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/enceve/crypto v0.0.0-20160707101852-34d48bb93815 // indirect
Expand All @@ -63,10 +63,10 @@ require (
github.com/prometheus/procfs v0.10.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/term v0.11.0
golang.org/x/text v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/grpc v1.56.2 // indirect
google.golang.org/protobuf v1.31.0 // indirect
Expand Down
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ cloud.google.com/go/kms v1.15.0 h1:xYl5WEaSekKYN5gGRyhjvZKM22GVBBCzegGNVPy+aIs=
cloud.google.com/go/kms v1.15.0/go.mod h1:c9J991h5DTl+kg7gi3MYomh12YEENGrf48ee/N/2CDM=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/aws/aws-sdk-go v1.44.305 h1:fU/5lY3WyBjGU9fkmQYd8o4fZu+2RaOv/i+sPaJVvFg=
github.com/aws/aws-sdk-go v1.44.305/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go v1.44.318 h1:Yl66rpbQHFUbxe9JBKLcvOvRivhVgP6+zH0b9KzARX8=
github.com/aws/aws-sdk-go v1.44.318/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
Expand Down Expand Up @@ -55,8 +55,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.14.1 h1:9c50NUPC30zyuKprjL3vNZ0m5oG+jU0zvx4AqHGnv4k=
github.com/go-playground/validator/v10 v10.14.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/go-playground/validator/v10 v10.15.0 h1:nDU5XeOKtB3GEa+uB7GNYwhVKsgjAR7VgKoNB6ryXfw=
github.com/go-playground/validator/v10 v10.15.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE=
Expand Down Expand Up @@ -165,8 +165,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20230420155640-133eef4313cb h1:rhjz/8Mbfa8xROFiH+MQphmAmgqRM0bOMnytznhWEXk=
golang.org/x/exp v0.0.0-20230420155640-133eef4313cb/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
Expand All @@ -188,12 +188,12 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8=
golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI=
golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU=
golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down Expand Up @@ -226,8 +226,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
Expand Down
7 changes: 5 additions & 2 deletions integration_test/.env.vaults
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ export VAULT_AWS_USER=${{ secrets.INTEGRATIONTEST_VAULT_AWS_USER }}
export VAULT_AWS_KEY=${{ secrets.INTEGRATIONTEST_VAULT_AWS_KEY }}
export VAULT_AWS_SECRET=${{ secrets.INTEGRATIONTEST_VAULT_AWS_SECRET }}
export VAULT_AWS_REGION=${{ secrets.INTEGRATIONTEST_VAULT_AWS_REGION }}
export VAULT_AWS_PKH_TZ2=${{ secrets.INTEGRATIONTEST_VAULT_AWS_TZ2 }}
export VAULT_AWS_PKH_TZ3=${{ secrets.INTEGRATIONTEST_VAULT_AWS_TZ3 }}
export VAULT_AWS_TZ2=${{ secrets.INTEGRATIONTEST_VAULT_AWS_TZ2 }}
export VAULT_AWS_TZ3=${{ secrets.INTEGRATIONTEST_VAULT_AWS_TZ3 }}
export VAULT_AWS_TZ3_PK=${{ secrets.INTEGRATIONTEST_VAULT_AWS_TZ3_PK }}

export VAULT_AZ_CLIENTCERTTHUMB=${{ secrets.INTEGRATIONTEST_VAULT_AZ_CLIENTCERTTHUMB }}
export VAULT_AZ_CLIENTID=${{ secrets.INTEGRATIONTEST_VAULT_AZ_CLIENTID }}
Expand All @@ -14,6 +15,7 @@ export VAULT_AZ_TENANTID=${{ secrets.INTEGRATIONTEST_VAULT_AZ_TENANTID }}
export VAULT_AZ_VAULT=${{ secrets.INTEGRATIONTEST_VAULT_AZ_VAULT }}
export VAULT_AZ_TZ2=${{ secrets.INTEGRATIONTEST_VAULT_AZ_TZ2 }}
export VAULT_AZ_TZ3=${{ secrets.INTEGRATIONTEST_VAULT_AZ_TZ3 }}
export VAULT_AZ_TZ3_PK=${{ secrets.INTEGRATIONTEST_VAULT_AZ_TZ3_PK }}

export VAULT_GCP_PROJECTID=${{ secrets.INTEGRATIONTEST_VAULT_GCP_PROJECTID }}
export VAULT_GCP_PRIVATEKEYID=${{ secrets.INTEGRATIONTEST_VAULT_GCP_PRIVATEKEYID }}
Expand All @@ -24,3 +26,4 @@ export VAULT_GCP_X509_URL=${{ secrets.INTEGRATIONTEST_VAULT_GCP_X509_URL }}
export VAULT_GCP_KEYRING=${{ secrets.INTEGRATIONTEST_VAULT_GCP_KEYRING }}
export VAULT_GCP_LOCATION=${{ secrets.INTEGRATIONTEST_VAULT_GCP_LOCATION }}
export VAULT_GCP_TZ3=${{ secrets.INTEGRATIONTEST_VAULT_GCP_TZ3 }}
export VAULT_GCP_TZ3_PK=${{ secrets.INTEGRATIONTEST_VAULT_GCP_TZ3_PK }}
4 changes: 3 additions & 1 deletion integration_test/.tezos-client/public_key_hashs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
{ "name": "bob", "value": "tz1aSkwEot3L2kmUvcoxzjMomb9mvBNuzFK6" },
{ "name": "opstest", "value": "tz1RKGhRF4TZNCXEfwyqZshGsVfrZeVU446B" },
{ "name": "opstest1", "value": "tz1R8HJMzVdZ9RqLCknxeq9w5rSbiqJ41szi" },
{ "name": "speculos", "value": "tz1RVYaHiobUKXMfJ47F7Rjxx5tu3LC35WSA" } ]
{ "name": "speculos", "value": "tz1RVYaHiobUKXMfJ47F7Rjxx5tu3LC35WSA" },
{ "name": "tz2alias", "value": "tz2QPsZoZse4eeahhg5DdfnBDB4VbU1PwgxN" },
{ "name": "tz4alias", "value": "tz4XXtsYav3fZz2FSDa7hcx4F8sh8SaDWNME" } ]
12 changes: 11 additions & 1 deletion integration_test/.tezos-client/public_keys
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,14 @@
"value":
{ "locator":
"http://signatory:6732/tz1RVYaHiobUKXMfJ47F7Rjxx5tu3LC35WSA",
"key": "edpktsKqhvR7kXbRWD7yDgLSD7PZUXvjLqf9SFscXhL52pUStF5nQp" } } ]
"key": "edpktsKqhvR7kXbRWD7yDgLSD7PZUXvjLqf9SFscXhL52pUStF5nQp" } },
{ "name": "tz2alias",
"value":
{ "locator":
"http://signatory:6732/tz2QPsZoZse4eeahhg5DdfnBDB4VbU1PwgxN",
"key": "sppk7cvVVMRRtYTdriTB6KQqpXZt9TUwSTcpMWq4FwpvG2eVZ56UuHP" } },
{ "name": "tz4alias",
"value":
{ "locator":
"http://signatory:6732/tz4XXtsYav3fZz2FSDa7hcx4F8sh8SaDWNME",
"key": "BLpk1nRV5SBB2QCxsiem5Neoywcizr3mkdp167HL1iKFgFvzPhKo4RSy7J8JBh2BgGgVYjNsRGwU" } } ]
6 changes: 5 additions & 1 deletion integration_test/.tezos-client/secret_keys
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@
{ "name": "opstest1",
"value": "http://signatory:6732/tz1R8HJMzVdZ9RqLCknxeq9w5rSbiqJ41szi" },
{ "name": "speculos",
"value": "http://signatory:6732/tz1RVYaHiobUKXMfJ47F7Rjxx5tu3LC35WSA" } ]
"value": "http://signatory:6732/tz1RVYaHiobUKXMfJ47F7Rjxx5tu3LC35WSA" },
{ "name": "tz2alias",
"value": "http://signatory:6732/tz2QPsZoZse4eeahhg5DdfnBDB4VbU1PwgxN" },
{ "name": "tz4alias",
"value": "http://signatory:6732/tz4XXtsYav3fZz2FSDa7hcx4F8sh8SaDWNME" } ]
2 changes: 2 additions & 0 deletions integration_test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ echo $PAT |docker login ghcr.io -u <your_github_name> --password-stdin

## Running the tests

The tests are run in a [github workflow](/.github/workflows/build.yaml) and so the workflow should be consulted to learn how to run the tests locally. A more verbose explanation:

```sh
cd integration_test
```
Expand Down
26 changes: 26 additions & 0 deletions integration_test/addresstypes_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package integrationtest

import (
"testing"

"github.com/stretchr/testify/require"
)

//there are enough existing integration tests using tz1 and tz3 addresses that it would be redundant to do so here

func TestTz4(t *testing.T) {
//flextesa does not start when we try to use a tz4 bootstrap account, so, we have to fund it first
out, err := OctezClient("-w", "1", "transfer", "200", "from", "alice", "to", "tz4alias", "--burn-cap", "0.06425")
require.NoError(t, err)
require.Contains(t, string(out), "Operation successfully injected in the node")

out, err = OctezClient("-w", "1", "transfer", "100", "from", "tz4alias", "to", "alice", "--burn-cap", "0.06425")
require.NoError(t, err)
require.Contains(t, string(out), "Operation successfully injected in the node")
}

func TestTz2(t *testing.T) {
out, err := OctezClient("-w", "1", "transfer", "100", "from", "tz2alias", "to", "alice", "--burn-cap", "0.06425")
require.NoError(t, err)
require.Contains(t, string(out), "Operation successfully injected in the node")
}
97 changes: 97 additions & 0 deletions integration_test/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,101 @@ func TestCliList(t *testing.T) {
out, err := SignatoryCli("list")
assert.Nil(t, err)
require.Contains(t, string(out), "tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb")
require.Contains(t, string(out), "tz2QPsZoZse4eeahhg5DdfnBDB4VbU1PwgxN")
require.Contains(t, string(out), "tz3Y2TkhTYG6MfPsijGfHFqBYrLCfwYb6HRB")
require.Contains(t, string(out), "tz4XXtsYav3fZz2FSDa7hcx4F8sh8SaDWNME")
}

func TestCliUsage(t *testing.T) {
out, err := SignatoryCli()
assert.Nil(t, err)
require.Contains(t, string(out), "Usage:")
require.Contains(t, string(out), "signatory-cli [command]")
require.Contains(t, string(out), "completion Generate the autocompletion script for the specified shell")
require.Contains(t, string(out), "help Help about any command")
require.Contains(t, string(out), "import Import Tezos private keys (edsk..., spsk..., p2sk...)")
require.Contains(t, string(out), "ledger Ledger specific operations")
require.Contains(t, string(out), "list List public keys")
require.Contains(t, string(out), "list-ops Print possible operation types inside the `generic` request")
require.Contains(t, string(out), "list-requests Print possible request types")
require.Contains(t, string(out), "version Show signatory image version/release (short alias 'v')")
}

// If/when Issue #425 is fixed, this test will break. to fix it, leverage the function in this package named "getAllOps"
func TestCliListOps(t *testing.T) {
out, err := SignatoryCli("list-ops")
assert.Nil(t, err)
require.Contains(t, string(out), "Possible operation types:")
require.Contains(t, string(out), "- activate_account")
require.Contains(t, string(out), "- ballot")
require.Contains(t, string(out), "- delegation")
require.Contains(t, string(out), "- double_baking_evidence")
require.Contains(t, string(out), "- double_endorsement_evidence")
require.Contains(t, string(out), "- double_preendorsement_evidence")
require.Contains(t, string(out), "- drain_delegate")
require.Contains(t, string(out), "- endorsement")
require.Contains(t, string(out), "- endorsement_with_slot")
require.Contains(t, string(out), "- failing_noop")
require.Contains(t, string(out), "- increase_paid_storage")
require.Contains(t, string(out), "- origination")
require.Contains(t, string(out), "- preendorsement")
require.Contains(t, string(out), "- proposals")
require.Contains(t, string(out), "- register_global_constant")
require.Contains(t, string(out), "- reveal")
require.Contains(t, string(out), "- seed_nonce_revelation")
require.Contains(t, string(out), "- set_deposits_limit")
require.Contains(t, string(out), "- transaction")
require.Contains(t, string(out), "- update_consensus_key")
require.Contains(t, string(out), "- vdf_revelation")
}

func TestCliListRequests(t *testing.T) {
out, err := SignatoryCli("list-requests")
assert.Nil(t, err)
require.Contains(t, string(out), "Possible request types:")
require.Contains(t, string(out), "- block")
require.Contains(t, string(out), "- endorsement")
require.Contains(t, string(out), "- generic")
require.Contains(t, string(out), "- preendorsement")
}

func TestCliHelp(t *testing.T) {
usage, err := SignatoryCli()
assert.Nil(t, err)
help, err := SignatoryCli("help")
assert.Nil(t, err)
require.Contains(t, string(help), string(usage))
}

func TestCliLedgerUsage(t *testing.T) {
out, err := SignatoryCli("ledger")
assert.Nil(t, err)
require.Contains(t, string(out), "Ledger specific operations")
require.Contains(t, string(out), "Usage:")
require.Contains(t, string(out), "signatory-cli ledger [command]")
require.Contains(t, string(out), "Available Commands:")
require.Contains(t, string(out), "deauthorize-baking Deuthorize a key")
require.Contains(t, string(out), "get-high-watermark Get high water mark")
require.Contains(t, string(out), "get-high-watermarks Get all high water marks and chain ID")
require.Contains(t, string(out), "list List connected Ledgers")
require.Contains(t, string(out), "set-high-watermark Set high water mark")
require.Contains(t, string(out), "setup-baking Authorize a key for baking")
require.Contains(t, string(out), "Use \"signatory-cli ledger [command] --help\" for more information about a command.")
}

func TestCliLedgerList(t *testing.T) {
out, err := SignatoryCli("ledger", "-t", "tcp://speculos:9999", "list")
assert.Nil(t, err)
require.Contains(t, string(out), "Path: speculos:9999")
require.Contains(t, string(out), "ID:")
require.Contains(t, string(out), "Version:")
}

func TestCliVersion(t *testing.T) {
v, err := SignatoryCli("v")
assert.Nil(t, err)
require.Contains(t, string(v), "Release Version: ")
require.Greater(t, len(v), len("Release Version: ")+4)
version, err := SignatoryCli("version")
require.Equal(t, v, version)
}
14 changes: 14 additions & 0 deletions integration_test/cover.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

#this script is used on a test developer's workstation to get coverage info
#it works on macos

rm -f covraw.txt
go tool covdata textfmt -i=./coverage -o covraw.txt
sed -i '' 's/\/go\/src\/github.com/github.com/g' covraw.txt
rm -f cov.txt
go tool cover -func covraw.txt -o cov.txt
cat cov.txt
rm -f cov.html
go tool cover -html covraw.txt -o cov.html
open cov.html
Loading

0 comments on commit 4965e4c

Please sign in to comment.