Skip to content

Instantly share code, notes, and snippets.

@kirbyquerby
Last active August 3, 2022 04:43
Show Gist options
  • Save kirbyquerby/0b6be3491f27ff99cb4190577331af5f to your computer and use it in GitHub Desktop.
Save kirbyquerby/0b6be3491f27ff99cb4190577331af5f to your computer and use it in GitHub Desktop.
diff to use nonroot user
diff --git a/tests/e2e/e2e_setup_test.go b/tests/e2e/e2e_setup_test.go
index f2b834968..13f6b8d67 100644
--- a/tests/e2e/e2e_setup_test.go
+++ b/tests/e2e/e2e_setup_test.go
@@ -9,6 +9,7 @@ import (
"io/ioutil"
"net/http"
"os"
+ "os/exec"
"path"
"path/filepath"
"strconv"
@@ -308,11 +309,13 @@ func (s *IntegrationTestSuite) runValidators(c *chain, portOffset int) {
Name: val.instanceName(),
NetworkID: s.dkrNet.Network.ID,
Mounts: []string{
- fmt.Sprintf("%s/:/root/.gaia", val.configDir()),
+ fmt.Sprintf("%s/:/home/nonroot/.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{
diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go
index 24dd4d02f..b0c9537c2 100644
--- a/tests/e2e/e2e_test.go
+++ b/tests/e2e/e2e_test.go
@@ -130,7 +130,7 @@ func (s *IntegrationTestSuite) TestSendTokensFromNewGovAccount() {
proposalCounter++
s.T().Logf("Submitting Gov Proposal: Sending Tokens from Gov Module to Recipient")
- s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, "/root/.gaia/config/proposal_2.json")
+ s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, "/home/nonroot/.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")
@@ -162,7 +162,7 @@ func (s *IntegrationTestSuite) TestGovSoftwareUpgrade() {
s.writeGovUpgradeSoftwareProposal(s.chainA, proposalHeight)
s.T().Logf("Submitting Gov Proposal: Software Upgrade")
- s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, "/root/.gaia/config/proposal_3.json")
+ s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, "/home/nonroot/.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")
@@ -211,14 +211,14 @@ func (s *IntegrationTestSuite) TestGovCancelSoftwareUpgrade() {
s.writeGovUpgradeSoftwareProposal(s.chainA, proposalHeight)
s.T().Logf("Submitting Gov Proposal: Software Upgrade")
- s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, "/root/.gaia/config/proposal_3.json")
+ s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, "/home/nonroot/.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, "/root/.gaia/config/proposal_4.json")
+ s.submitNewGovProposal(chainAAPIEndpoint, sender, proposalCounter, "/home/nonroot/.gaia/config/proposal_4.json")
s.depositGovProposal(chainAAPIEndpoint, sender, proposalCounter)
s.voteGovProposal(chainAAPIEndpoint, sender, proposalCounter, "yes", false)
@@ -254,7 +254,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, "/root/.gaia/config/proposal.json", fees.String(), "community-pool-spend")
+ s.execGovSubmitLegacyGovProposal(s.chainA, 0, chainAAPIEndpoint, sender, "/home/nonroot/.gaia/config/proposal.json", fees.String(), "community-pool-spend")
s.Require().Eventually(
func() bool {
diff --git a/tests/e2e/e2e_util_test.go b/tests/e2e/e2e_util_test.go
index e119fe788..853f82e55 100644
--- a/tests/e2e/e2e_util_test.go
+++ b/tests/e2e/e2e_util_test.go
@@ -28,7 +28,7 @@ func (s *IntegrationTestSuite) connectIBCChains() {
AttachStdout: true,
AttachStderr: true,
Container: s.hermesResource.Container.ID,
- User: "root",
+ User: "nonroot",
Cmd: []string{
"hermes",
"create",
@@ -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: "root",
+ User: "nonroot",
Cmd: []string{
"gaiad",
"tx",
@@ -137,7 +137,7 @@ func (s *IntegrationTestSuite) sendIBC(srcChainID, dstChainID, recipient string,
AttachStdout: true,
AttachStderr: true,
Container: s.hermesResource.Container.ID,
- User: "root",
+ User: "nonroot",
Cmd: []string{
"hermes",
"tx",
@@ -336,7 +336,7 @@ func (s *IntegrationTestSuite) executeGaiaTxCommand(ctx context.Context, c *chai
AttachStdout: true,
AttachStderr: true,
Container: s.valResources[c.id][valIdx].Container.ID,
- User: "root",
+ User: "nonroot",
Cmd: gaiaCommand,
})
s.Require().NoError(err)
@@ -424,7 +424,7 @@ func (s *IntegrationTestSuite) getLatestBlockHeight(c *chain, valIdx int) int {
AttachStdout: true,
AttachStderr: true,
Container: s.valResources[c.id][valIdx].Container.ID,
- User: "root",
+ User: "nonroot",
Cmd: []string{"gaiad", "status"},
})
s.Require().NoError(err)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment