Skip to content

Commit

Permalink
automated upgrade tests (#530)
Browse files Browse the repository at this point in the history
* add wrapper

* fix step name

* check files

* no cgo

* fix lint issues

* fix missing dep

* send http status

* fix order

* ignore error

* switch target branch to main

* update go

* fix order
  • Loading branch information
jhernandezb authored Jan 25, 2022
1 parent 62138d7 commit a3dedb4
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 14 deletions.
27 changes: 20 additions & 7 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ steps:
- '/go/pkg/mod'

- name: test
image: publicawesome/golang:1.17.0-devtooling
image: publicawesome/golang:1.17.6-devtooling
volumes:
- name: cache
path: /go
Expand Down Expand Up @@ -209,7 +209,7 @@ steps:
environment:
GOPROXY: http://goproxy
- name: stargaze
image: publicawesome/golang:1.17.0-devtooling
image: publicawesome/golang:1.17.6-devtooling
volumes:
- name: cache
path: /go
Expand Down Expand Up @@ -288,6 +288,17 @@ steps:
region: us-east-1
mount:
- '/go/pkg/mod'
- name: build-wrapper
image: publicawesome/golang:1.17.6-devtooling
volumes:
- name: cache
path: /go
commands:
- mkdir -p /stargaze/bin/
- CGO_ENABLED=0 go build -o /stargaze/bin/upgrade-watcher ./testutil/watcher/
- chmod +x /stargaze/bin/upgrade-watcher
environment:
GOPROXY: http://goproxy
- name: gaia
image: publicawesome/gaia:6.0.0
detach: true
Expand All @@ -303,7 +314,7 @@ steps:
environment:
GOPROXY: http://goproxy
- name: stargaze
image: publicawesome/stargaze:1.1.2
image: publicawesome/stargaze:1.1.3
commands:
- ./scripts/ci/upgrade/setup-preinstalled-stargaze.sh
environment:
Expand Down Expand Up @@ -333,11 +344,11 @@ steps:
commands:
- /bin/bash ./scripts/ci/transfer-relayer.sh
- name: proposal
image: publicawesome/stargaze:1.1.2
image: publicawesome/stargaze:1.1.3
commands:
- ./scripts/ci/upgrade/proposal.sh
- name: stargaze-upgraded
image: publicawesome/stargaze:2.0.0-rc.1
image: publicawesome/stargaze:2.0.0
commands:
- ./scripts/ci/upgrade/run-upgrade.sh
environment:
Expand Down Expand Up @@ -373,7 +384,7 @@ steps:

trigger:
branch:
- feature/upgrade-test
- main
event:
- pull_request
- push
Expand All @@ -382,8 +393,10 @@ volumes:
temp: {}
node:
runner: integration
depends_on:
- ibc-integration-test
---
kind: signature
hmac: 92949f5f6808f267a5c0b9975c6df058bec57ba34e3b5db5fa933e50ab4cc106
hmac: 2afdd67fa7a871d8ff1b9412f304cc7908b029f47f92f184c197e0c4bd0b7efe

...
2 changes: 1 addition & 1 deletion docker/Dockerfile.go-devtools
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# docker build . -t publicawesome/golang:1.17.0-devtooling -f docker/Dockerfile.go-devtools
FROM golang:1.17.0
FROM golang:1.17.6
RUN apt-get update && \
apt-get install -y cmake && \
apt-get -y clean && \
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.hermes
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Used for running hermes in docker containers
#
# Usage:
# docker build . --build-arg TAG=v0.9.0 -t publicawesome/hermes:0.9.0 -f docker/Dockerfile.hermes
# docker build . --build-arg TAG=v0.10.0 -t publicawesome/hermes:0.10.0 -f docker/Dockerfile.hermes

FROM rust:1.52-buster AS build-env

Expand Down
5 changes: 3 additions & 2 deletions scripts/ci/upgrade/run-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ DENOM=ustars
CHAINID=stargaze
RLYKEY=stars12g0xe2ld0k5ws3h7lmxc39d4rpl3fyxp5qys69
starsd version --long
apk add -U --no-cache jq tree
apk add -U --no-cache jq tree curl wget
STARGAZE_HOME=/stargaze/starsd

curl -s -v http://stargaze:8090/kill || echo "done"
sleep 10
starsd start --pruning nothing --home $STARGAZE_HOME
4 changes: 1 addition & 3 deletions scripts/ci/upgrade/setup-preinstalled-stargaze.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ sed -i 's/pruning = "syncable"/pruning = "nothing"/g' $STARGAZE_HOME/config/app.
sed -i 's/enable = false/enable = true/g' $STARGAZE_HOME/config/app.toml
sed -i 's/172800s/60s/g' $STARGAZE_HOME/config/genesis.json
starsd keys --keyring-backend test add validator --home $STARGAZE_HOME
tree -L 2 $STARGAZE_HOME
starsd add-genesis-account $(starsd keys --keyring-backend test show validator -a --home $STARGAZE_HOME) 10000000000000$DENOM --home $STARGAZE_HOME
starsd add-genesis-account $RLYKEY 10000000000000$DENOM --home $STARGAZE_HOME
starsd gentx validator 900000000$DENOM --keyring-backend test --chain-id stargaze --home $STARGAZE_HOME
starsd collect-gentxs --home $STARGAZE_HOME

starsd start --pruning nothing --home $STARGAZE_HOME
/stargaze/bin/upgrade-watcher starsd start --pruning nothing --home $STARGAZE_HOME
43 changes: 43 additions & 0 deletions testutil/watcher/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package main

import (
"fmt"
"log"
"net/http"
"os"
"os/exec"
)

func main() {
args := os.Args[1:]

if len(args) < 2 {
log.Fatal("missing arguments")
}
/* #nosec */
cmd := exec.Command(args[0], args[1:]...)
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
if err := cmd.Start(); err != nil {
log.Fatal(err)
}
server := &http.Server{Addr: ":8090", Handler: nil}
http.HandleFunc("/kill", func(w http.ResponseWriter, r *http.Request) {
err := cmd.Process.Kill()
if err != nil {
fmt.Println("error killing process", err)
}
_, _ = w.Write([]byte(string("OK")))
w.WriteHeader(http.StatusAccepted)
err = server.Shutdown(r.Context())
if err != nil {
fmt.Println("error shuting down", err)
}
})
err := server.ListenAndServe()
_ = cmd.Process.Kill()
if err != nil {

log.Fatal(err)
}
}

0 comments on commit a3dedb4

Please sign in to comment.