Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
okwme committed Aug 4, 2022
2 parents f1421e6 + 3ee1998 commit 42dc17e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 21 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ RUN apk add --no-cache $PACKAGES
RUN CGO_ENABLED=0 make install

# Add to a distroless container
FROM distroless.dev/static:$IMG_TAG
FROM gcr.io/distroless/cc:$IMG_TAG
ARG IMG_TAG
COPY --from=gaiad-builder /go/bin/gaiad /usr/local/bin/
EXPOSE 26656 26657 1317 9090
USER 0

ENTRYPOINT ["gaiad", "start"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ endif
.PHONY: run-tests $(TEST_TARGETS)

docker-build-debug:
@docker build -t cosmos/gaiad-e2e -f e2e.Dockerfile .
@docker build -t cosmos/gaiad-e2e --build-arg IMG_TAG=debug -f e2e.Dockerfile .

# TODO: Push this to the Cosmos Dockerhub so we don't have to keep building it
# in CI.
Expand Down
2 changes: 1 addition & 1 deletion e2e.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN apk add --no-cache $PACKAGES
RUN CGO_ENABLED=0 make install

# Add to a distroless container
FROM distroless.dev/static:$IMG_TAG
FROM gcr.io/distroless/cc:$IMG_TAG
ARG IMG_TAG
COPY --from=gaiad-builder /go/bin/gaiad /usr/local/bin/
EXPOSE 26656 26657 1317 9090
Expand Down
7 changes: 2 additions & 5 deletions tests/e2e/e2e_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"io/ioutil"
"net/http"
"os"
"os/exec"
"path"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -246,7 +245,7 @@ func (s *IntegrationTestSuite) initGenesis(c *chain) {
bz, err = tmjson.MarshalIndent(genDoc, "", " ")
s.Require().NoError(err)

// write the updated genesis file to each validator.
// write the updated genesis file to each validator
for _, val := range c.validators {
err = writeFile(filepath.Join(val.configDir(), "config", "genesis.json"), bz)
s.Require().NoError(err)
Expand Down Expand Up @@ -309,13 +308,11 @@ func (s *IntegrationTestSuite) runValidators(c *chain, portOffset int) {
Name: val.instanceName(),
NetworkID: s.dkrNet.Network.ID,
Mounts: []string{
fmt.Sprintf("%s/:/home/nonroot/.gaia", val.configDir()),
fmt.Sprintf("%s/:/root/.gaia", val.configDir()),
},
Repository: "cosmos/gaiad-e2e",
}

s.Require().NoError(exec.Command("chmod", "-R", "0777", val.configDir()).Run())

// expose the first validator for debugging and communication
if val.index == 0 {
runOpts.PortBindings = map[docker.Port][]docker.PortBinding{
Expand Down
13 changes: 6 additions & 7 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (s *IntegrationTestSuite) TestSendTokensFromNewGovAccount() {
proposalCounter++

s.T().Logf("Submitting Gov Proposal: Sending Tokens from Gov Module to Recipient")
s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, "/home/nonroot/.gaia/config/proposal_2.json")
s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, "/root/.gaia/config/proposal_2.json")
s.T().Logf("Depositing Gov Proposal: Sending Tokens from Gov Module to Recipient")
s.depositGovProposal(chainAAPIEndpoint, sender, proposalCounter)
s.T().Logf("Voting Gov Proposal: Sending Tokens from Gov Module to Recipient")
Expand Down Expand Up @@ -158,17 +158,16 @@ func (s *IntegrationTestSuite) TestGovSoftwareUpgrade() {
s.writeGovUpgradeSoftwareProposal(s.chainA, proposalHeight)

s.T().Logf("Submitting Gov Proposal: Software Upgrade")
s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, "/home/nonroot/.gaia/config/proposal_3.json")
s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, "/root/.gaia/config/proposal_3.json")
s.T().Logf("Depositing Gov Proposal: Software Upgrade")
s.depositGovProposal(chainAAPIEndpoint, sender, proposalCounter)
s.T().Logf("Weighted Voting Gov Proposal: Software Upgrade")
s.voteGovProposal(chainAAPIEndpoint, sender, proposalCounter, "yes=0.8,no=0.1,abstain=0.05,no_with_veto=0.05", true)

s.verifyChainHaltedAtUpgradeHeight(s.chainA, 0, proposalHeight)
s.T().Logf("Successfully halted chain at height %d", proposalHeight)
fmt.Println("s.valResources", s.valResources)
s.TearDownSuite()

s.TearDownSuite()

s.T().Logf("Restarting containers")
s.SetupSuite()
Expand Down Expand Up @@ -202,14 +201,14 @@ func (s *IntegrationTestSuite) TestGovCancelSoftwareUpgrade() {
s.writeGovUpgradeSoftwareProposal(s.chainA, proposalHeight)

s.T().Logf("Submitting Gov Proposal: Software Upgrade")
s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, "/home/nonroot/.gaia/config/proposal_3.json")
s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, "/root/.gaia/config/proposal_3.json")
s.depositGovProposal(chainAAPIEndpoint, sender, proposalCounter)
s.voteGovProposal(chainAAPIEndpoint, sender, proposalCounter, "yes", false)

proposalCounter++

s.T().Logf("Submitting Gov Proposal: Cancel Software Upgrade")
s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, "/home/nonroot/.gaia/config/proposal_4.json")
s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, "/root/.gaia/config/proposal_4.json")
s.depositGovProposal(chainAAPIEndpoint, sender, proposalCounter)
s.voteGovProposal(chainAAPIEndpoint, sender, proposalCounter, "yes", false)

Expand Down Expand Up @@ -248,7 +247,7 @@ func (s *IntegrationTestSuite) fundCommunityPool(chainAAPIEndpoint string, sende

func (s *IntegrationTestSuite) submitLegacyProposalFundGovAccount(chainAAPIEndpoint string, sender string, proposalId int) {
s.Run("submit_legacy_community_spend_proposal_to_fund_gov_acct", func() {
s.execGovSubmitLegacyGovProposal(s.chainA, 0, chainAAPIEndpoint, sender, "/home/nonroot/.gaia/config/proposal.json", fees.String(), "community-pool-spend")
s.execGovSubmitLegacyGovProposal(s.chainA, 0, chainAAPIEndpoint, sender, "/root/.gaia/config/proposal.json", fees.String(), "community-pool-spend")

s.Require().Eventually(
func() bool {
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/e2e_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (s *IntegrationTestSuite) connectIBCChains() {
AttachStdout: true,
AttachStderr: true,
Container: s.hermesResource.Container.ID,
User: "nonroot",
User: "root",
Cmd: []string{
"hermes",
"create",
Expand Down Expand Up @@ -77,7 +77,7 @@ func (s *IntegrationTestSuite) sendMsgSend(c *chain, valIdx int, from, to, amt,
AttachStdout: true,
AttachStderr: true,
Container: s.valResources[c.id][valIdx].Container.ID,
User: "nonroot",
User: "root",
Cmd: []string{
"gaiad",
"tx",
Expand Down Expand Up @@ -137,7 +137,7 @@ func (s *IntegrationTestSuite) sendIBC(srcChainID, dstChainID, recipient string,
AttachStdout: true,
AttachStderr: true,
Container: s.hermesResource.Container.ID,
User: "nonroot",
User: "root",
Cmd: []string{
"hermes",
"tx",
Expand Down Expand Up @@ -337,7 +337,7 @@ func (s *IntegrationTestSuite) executeGaiaTxCommand(ctx context.Context, c *chai
AttachStdout: true,
AttachStderr: true,
Container: s.valResources[c.id][valIdx].Container.ID,
User: "nonroot",
User: "root",
Cmd: gaiaCommand,
})
s.Require().NoError(err)
Expand Down Expand Up @@ -426,7 +426,7 @@ func (s *IntegrationTestSuite) getLatestBlockHeight(c *chain, valIdx int) int {
AttachStdout: true,
AttachStderr: true,
Container: s.valResources[c.id][valIdx].Container.ID,
User: "nonroot",
User: "root",
Cmd: []string{"gaiad", "status"},
})
s.Require().NoError(err)
Expand Down

0 comments on commit 42dc17e

Please sign in to comment.