From 3c30c9ed14c80908a93c0445023d056faefd44c1 Mon Sep 17 00:00:00 2001 From: Artur Troian Date: Sat, 27 Jan 2024 13:48:38 -0500 Subject: [PATCH] refactor: move inventory-grpc-probe to akash-api repo (#176) Signed-off-by: Artur Troian --- .github/workflows/integration-tests.yaml | 13 ++-- go.mod | 2 +- go.sum | 4 +- script/inventory-grpc-probe.sh | 95 ------------------------ 4 files changed, 10 insertions(+), 104 deletions(-) delete mode 100755 script/inventory-grpc-probe.sh diff --git a/.github/workflows/integration-tests.yaml b/.github/workflows/integration-tests.yaml index 43294a0d..38da3058 100644 --- a/.github/workflows/integration-tests.yaml +++ b/.github/workflows/integration-tests.yaml @@ -60,13 +60,10 @@ jobs: cd ${{ env.GOPATH }}/src/github.com/akash-network/akash-api cat "$GITHUB_ENV" > "$GITHUB_WORKSPACE/env.backup" direnv export gha >> "$GITHUB_ENV" - - name: Add akash-api to go.work + - name: Run modvendor on akash-api working-directory: ${{ env.GOPATH }}/src/github.com/akash-network/akash-api run: | make modvendor - printf "use (\n\t.\n)\n" > ../provider/go.work - printf "\ngo ${{ env.GOVERSION }}\n" >> ../provider/go.work - printf "\nreplace (\n\tgithub.com/akash-network/akash-api => ../akash-api\n)\n" >> ../provider/go.work cat "$GITHUB_WORKSPACE/env.backup" > "$GITHUB_ENV" - name: Setup direnv for provider run: direnv export gha >> "$GITHUB_ENV" @@ -121,8 +118,12 @@ jobs: __pod=$(kubectl -n akash-services get pods -l app.kubernetes.io/part-of=provider -l app.kubernetes.io/component=operator -l app.kubernetes.io/instance=inventory-node --no-headers -o custom-columns=":metadata.name") kubectl -n akash-services port-forward --address 0.0.0.0 pod/$__pod 8444:grpc & kubectl -n akash-services port-forward --address 0.0.0.0 service/operator-inventory 8445:grpc & - ./script/inventory-grpc-probe.sh --host=localhost:8444 --mode=plaintext akash.inventory.v1.NodeRPC/QueryNode - ./script/inventory-grpc-probe.sh --host=localhost:8445 --mode=plaintext akash.inventory.v1.ClusterRPC/QueryCluster + + timeout 10 bash -c -- 'while ! nc -vz localhost 8445 > /dev/null 2>&1 ; do sleep 0.1; done' + timeout 10 bash -c -- 'while ! nc -vz localhost 8444 > /dev/null 2>&1 ; do sleep 0.1; done' + + ${{ env.GOPATH }}/src/github.com/akash-network/akash-api/script/grpc-probe.sh --host=localhost:8444 --mode=plaintext akash.inventory.v1.NodeRPC/QueryNode + ${{ env.GOPATH }}/src/github.com/akash-network/akash-api/script/grpc-probe.sh --host=localhost:8445 --mode=plaintext akash.inventory.v1.ClusterRPC/QueryCluster kubectl -n akash-services logs service/operator-inventory - name: Run E2E Tests working-directory: ${{ env.GOPATH }}/src/github.com/akash-network/provider diff --git a/go.mod b/go.mod index 612d0610..40188528 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/akash-network/provider go 1.21 require ( - github.com/akash-network/akash-api v0.0.43 + github.com/akash-network/akash-api v0.0.45 github.com/akash-network/node v0.30.1-rc4 github.com/avast/retry-go/v4 v4.5.0 github.com/blang/semver/v4 v4.0.0 diff --git a/go.sum b/go.sum index 2cab2797..99df7370 100644 --- a/go.sum +++ b/go.sum @@ -197,8 +197,8 @@ github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= -github.com/akash-network/akash-api v0.0.43 h1:IT/t/tVCVudyKRAx/lqX+eCQW/Yx21l4gBlgaVsHiFU= -github.com/akash-network/akash-api v0.0.43/go.mod h1:YZq1ukyGEknizGaE6g+A8yGupGqEN8hG8PGPPE8VAxA= +github.com/akash-network/akash-api v0.0.45 h1:NEEP3R+Y8WL6cmHequdhprPMIt2vVhdgwQIKgeDOjgE= +github.com/akash-network/akash-api v0.0.45/go.mod h1:YZq1ukyGEknizGaE6g+A8yGupGqEN8hG8PGPPE8VAxA= github.com/akash-network/cometbft v0.34.27-akash h1:V1dApDOr8Ee7BJzYyQ7Z9VBtrAul4+baMeA6C49dje0= github.com/akash-network/cometbft v0.34.27-akash/go.mod h1:BcCbhKv7ieM0KEddnYXvQZR+pZykTKReJJYf7YC7qhw= github.com/akash-network/ledger-go v0.14.3 h1:LCEFkTfgGA2xFMN2CtiKvXKE7dh0QSM77PJHCpSkaAo= diff --git a/script/inventory-grpc-probe.sh b/script/inventory-grpc-probe.sh deleted file mode 100755 index 6b207335..00000000 --- a/script/inventory-grpc-probe.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/env bash - -akash_api=$(go list -mod=readonly -m -f '{{ .Dir }}' github.com/akash-network/akash-api) - -if [ ! -d "${akash_api}/vendor" ]; then - echo "for script to work akash-api must be checkout locally and replace in go.work" - exit 1 -fi - -short_opts=h -long_opts=help/host:/mode: # those who take an arg END with : - -host=localhost:8081 -mode= - -while getopts ":$short_opts-:" o; do - case $o in - :) - echo >&2 "option -$OPTARG needs an argument" - continue - ;; - '?') - echo >&2 "bad option -$OPTARG" - continue - ;; - -) - o=${OPTARG%%=*} - OPTARG=${OPTARG#"$o"} - lo=/$long_opts/ - case $lo in - *"/$o"[!/:]*"/$o"[!/:]*) - echo >&2 "ambiguous option --$o" - continue - ;; - *"/$o"[:/]*) - ;; - *) - o=$o${lo#*"/$o"}; - o=${o%%[/:]*} - ;; - esac - - case $lo in - *"/$o/"*) - OPTARG= - ;; - *"/$o:/"*) - case $OPTARG in - '='*) - OPTARG=${OPTARG#=} - ;; - *) - eval "OPTARG=\$$OPTIND" - if [ "$OPTIND" -le "$#" ] && [ "$OPTARG" != -- ]; then - OPTIND=$((OPTIND + 1)) - else - echo >&2 "option --$o needs an argument" - continue - fi - ;; - esac - ;; - *) echo >&2 "unknown option --$o"; continue;; - esac - esac - case "$o" in - host) - host=$OPTARG - ;; - mode) - case "$OPTARG" in - plaintext|insecure) - ;; - *) - echo >&2 "option --$o can be plaintext|insecure" - ;; - esac - - mode=-$OPTARG - ;; - esac -done -shift "$((OPTIND - 1))" - -grpcurl \ - "$mode" \ - -use-reflection \ - -proto="${akash_api}/proto/provider/akash/inventory/v1/service.proto" \ - -proto="${akash_api}/proto/provider/akash/provider/v1/service.proto" \ - -import-path="${akash_api}/proto/provider" \ - -import-path="${akash_api}/proto/node" \ - -import-path="${akash_api}/vendor/github.com/cosmos/cosmos-sdk/third_party/proto" \ - -import-path="${akash_api}/vendor" \ - "$host" \ - "$@"