Skip to content

Commit

Permalink
refactor: MsgPolicyCmd -> MsgSignedPolicyCmd
Browse files Browse the repository at this point in the history
  • Loading branch information
Lodek committed Jul 1, 2024
1 parent 4ca7ce4 commit f2f671c
Show file tree
Hide file tree
Showing 36 changed files with 902 additions and 1,977 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ proto:
test:
go test ./...

.PHONY: test\:all
test\:all: test_env_generator
scripts/run-test-matrix

.PHONY: simulate
simulate:
ignite chain simulate
Expand All @@ -42,3 +46,7 @@ docs:
# the ID of the current git HEAD
image:
scripts/build-docker-image.sh

.PHONY: test_env_generator
test_env_generator:
go build -o build/test_env_generator cmd/test_env_generator/main.go
86 changes: 86 additions & 0 deletions cmd/test_env_generator/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package main

import (
"fmt"
"log"
"strconv"
"strings"

test "github.com/sourcenetwork/sourcehub/tests/integration/acp"
"github.com/sourcenetwork/sourcehub/utils"
"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
Use: "test_env_generator {permutation}",
Short: "test_env_generator permutates through SourceHub's test suite environment variables",
Long: `
test_env_generator outputs the set of environment variables which should be set for each test permutation.
With no input, prints the amount of permutations available.
Permutation numbering is 0 based (eg if there are permutations the allowed options arguments are 0, 1, 2)
`,
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
environs := genEnvirons()

if len(args) == 0 {
fmt.Printf("%v\n", len(environs))
return
}

if args[0] == "all" {
for _, env := range environs {
fmt.Println(env)
}
return
}

index, err := strconv.Atoi(args[0])
if err != nil {
log.Fatalf("%v is an invalid index", args[0])
}
if index < 0 || index > len(environs) {
log.Fatalf("index must be within [0, %v]", len(environs)-1)
}

println(environs[index])
},
}

func main() {
rootCmd.Execute()
}

func writeKV(builder *strings.Builder, key, value string) {
builder.WriteString("export ")
builder.WriteString(key)
builder.WriteRune('=')
builder.WriteRune('"')
builder.WriteString(value)
builder.WriteRune('"')
builder.WriteRune(' ')
builder.WriteRune(';')
}

func genEnvirons() []string {
combinations := len(test.ActorKeyMap) * len(test.ExecutorStrategyMap) * len(test.AuthenticationStrategyMap)
environs := make([]string, 0, combinations)

for actorKeyVar := range test.ActorKeyMap {
for executorVar := range test.ExecutorStrategyMap {
for authStratVar := range test.AuthenticationStrategyMap {
builder := strings.Builder{}
writeKV(&builder, test.SourceHubActorEnvVar, actorKeyVar)
writeKV(&builder, test.SourceHubExecutorEnvVar, executorVar)
writeKV(&builder, test.SourceHubAuthStratEnvVar, authStratVar)
environ := builder.String()
environs = append(environs, environ)
}
}
}

utils.SortSlice(environs)

return environs
}
34 changes: 14 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@ require (
github.com/cosmos/ibc-go/modules/capability v1.0.0
github.com/cosmos/ibc-go/v8 v8.0.0
github.com/cyware/ssi-sdk v0.0.0-20231229164914-f93f3006379f
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0
github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214
github.com/golang/protobuf v1.5.3
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.4.0
github.com/gorilla/mux v1.8.1
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1
github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230501135648-a9a7ad029347
github.com/sourcenetwork/raccoondb v0.2.0
github.com/sourcenetwork/zanzi v0.3.0
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.8.4
golang.org/x/tools v0.18.0
github.com/stretchr/testify v1.9.0
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f
google.golang.org/grpc v1.60.1
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0
Expand Down Expand Up @@ -81,9 +81,7 @@ require (
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/bits-and-blooms/bitset v1.11.0 // indirect
github.com/btcsuite/btcd v0.22.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
github.com/bufbuild/protocompile v0.6.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
Expand All @@ -110,7 +108,6 @@ require (
github.com/creachadair/tomledit v0.0.24 // indirect
github.com/danieljoos/wincred v1.2.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
Expand Down Expand Up @@ -141,7 +138,7 @@ require (
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.15.1 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/goccy/go-json v0.10.3 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gofrs/uuid/v5 v5.0.0 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
Expand Down Expand Up @@ -177,6 +174,7 @@ require (
github.com/hyperledger/aries-framework-go v0.3.2 // indirect
github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230427134832-0c9969493bd3 // indirect
github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 // indirect
github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230501135648-a9a7ad029347 // indirect
github.com/hyperledger/aries-framework-go/spi v0.0.0-20230427134832-0c9969493bd3 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
Expand All @@ -195,9 +193,9 @@ require (
github.com/leodido/go-urn v1.2.4 // indirect
github.com/lestrrat-go/blackmagic v1.0.2 // indirect
github.com/lestrrat-go/httpcc v1.0.1 // indirect
github.com/lestrrat-go/httprc v1.0.4 // indirect
github.com/lestrrat-go/httprc v1.0.5 // indirect
github.com/lestrrat-go/iter v1.0.2 // indirect
github.com/lestrrat-go/jwx/v2 v2.0.18 // indirect
github.com/lestrrat-go/jwx/v2 v2.1.0 // indirect
github.com/lestrrat-go/option v1.0.1 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
Expand Down Expand Up @@ -253,14 +251,10 @@ require (
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tendermint/tm-db v0.6.7 // indirect
github.com/teserakt-io/golang-ed25519 v0.0.0-20210104091850-3888c087a4c8 // indirect
github.com/tetratelabs/wazero v1.5.0 // indirect
github.com/tidwall/btree v1.7.0 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/vbatts/tar-split v0.11.5 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v0.14.3 // indirect
go.etcd.io/bbolt v1.3.8 // indirect
Expand All @@ -272,15 +266,15 @@ require (
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.153.0 // indirect
Expand Down
Loading

0 comments on commit f2f671c

Please sign in to comment.