Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R4R: Test that localnet-start makes at least 10 blocks #2018

Closed
wants to merge 23 commits into from

Conversation

jackzampolin
Copy link
Member

This PR adds the check to the Circle CI script to ensure that the make localnet-start command starts a testnet that can produce at least 10 blocks. cc @ValarDragon

@codecov
Copy link

codecov bot commented Aug 14, 2018

Codecov Report

Merging #2018 into develop will not change coverage.
The diff coverage is 0%.

@@           Coverage Diff            @@
##           develop    #2018   +/-   ##
========================================
  Coverage    64.86%   64.86%           
========================================
  Files          115      115           
  Lines         6862     6862           
========================================
  Hits          4451     4451           
  Misses        2127     2127           
  Partials       284      284

@ValarDragon
Copy link
Contributor

ValarDragon commented Aug 14, 2018

Looks like the docker container isn't printing out the NUMBER OF BLOCKS. I think its expecting the localnet to be started on the same docker instance. I don't know too much about docker to know if thats doable. But now its building :)

mslipper and others added 2 commits August 14, 2018 10:23
If dep already sees its scratch directory (.vendor-new), dep ensure fails. This rm -rf's that directory so make get_vendor_deps doesn't fail.
Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea! Notes:

  • Can we not rely on docker pull? Depends on an external repository (security threat) & often slow. Would prefer a local image with proper layer caching.
  • Do we need to use Docker at all?

@jackzampolin
Copy link
Member Author

@cwgoes I was trying to reuse the existing make localnet-start command to make this easy and that uses docker. One other option could be to just run the script from CI w/o a docker container. I can try and chase down that approach later. As for the external dependency, here is the repo: https://github.com/jackzampolin/gaiad-poll

Its really just 2 files. If we just run the script in circle, then we could reduce that to just the script. I think the hard part here is figuring out the docker networking. I'll try both approaches.

@alexanderbez
Copy link
Contributor

afaik, the docker-compose file just makes it very easy to start/stop a network, tail logs, etc...

@ValarDragon
Copy link
Contributor

ValarDragon commented Aug 14, 2018

I think using docker is fine here, it's part of a test. If putting the docker file in the sdk is doable, let's do that. I'd prefer to get this working with docker pull, and we make an issue for fixing that dep later. It's not a huge security concern because worst case is that one of our circle ci tests passes when it shouldn't have. (It's running in its own container and persists nothing)

@jackzampolin
Copy link
Member Author

jackzampolin commented Aug 14, 2018

So after doing a bit of testing here and playing around with circle's cool ssh feature (its cool). When running the docker-compose up -d step the containers failed to start. They exited with the message:

The binary gaiad cannot be found. Please add the binary to the shared folder. Please use the BINARY environment variable if the name of the binary is not 'gaiad' E.g.: -e BINARY=gaiad_my_test_version

This is kinda weird because the step before builds the linux binary. When I look where its supposed to be (./build/gaiad), it exists. This lead me to find out that Docker mounts (something we rely on for mounting the built binary) fail in the Circle 2.0 environment. This specific test requires the machine environment which supports docker mounts.

Running it in the machine environment caused a TON of file permissions issues. Womp! After moving the repo path to somewhere w/o the file permissions issues and eliminating the restore from cache piece I started running into $GOPATH issues. Once I started working w/in the go path setup on the build VM and got the containers running I finally got the script working and the containers running! Yay!

Now I'm running into this fun issue which looks like a Makefile issue 😢

LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 make build
make[1]: Entering directory `/home/circleci/.go_workspace/src/github.com/cosmos/cosmos-sdk'
TMP_BUILD_TAGS := netgo ledger
make[1]: TMP_BUILD_TAGS: Command not found
make[1]: *** [check-ledger] Error 127
make[1]: Leaving directory `/home/circleci/.go_workspace/src/github.com/cosmos/cosmos-sdk'
make: *** [build-linux] Error 2
Exited with code 2

Also this is going to need a rebase. Would love some feedback on the approach.

@zramsay
Copy link
Contributor

zramsay commented Aug 14, 2018

related: tendermint/tendermint#1532
once this PR is merged and is smooth, i'll add the same same to tendermint

@jackzampolin
Copy link
Member Author

I need an extra set of 👀 on this from @greg-szabo

@jackzampolin
Copy link
Member Author

Alright! ht to @greg-szabo for helping me find that <tab>s in the Makefile was causing the build failure. The test is currently unable to get past the 2nd block because of the nondeterminism issue we debugged yesterday. So this is ready for review!

@jackzampolin jackzampolin changed the title Add job to circle to test localnet R4R: Test that localnet-start makes at least 10 blocks Aug 15, 2018
Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with the concept, still a few concerns about implementation, see comments.

ifndef GCC
$(error "gcc not installed for ledger support, please install or set LEDGER_ENABLED to false in the Makefile")
endif
ifeq ($(UNAME_S),OpenBSD)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intended to be in this PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO :*(


BUG FIXES
* \#1988 Make us compile on OpenBSD (disable ledger) [#1988] (https://github.com/cosmos/cosmos-sdk/issues/1988)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intended to be in this PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO :(

@@ -38,6 +38,7 @@ BREAKING CHANGES
* [types] sdk.NewCoin now takes sdk.Int, sdk.NewInt64Coin takes int64
* [cli] #1551: Officially removed `--name` from CLI commands
* [cli] Genesis/key creation (`init`) now supports user-provided key passwords
* [cli] unsafe_reset_all, show_validator, and show_node_id have been renamed to unsafe-reset-all, show-validator, and show-node-id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intended to be in this PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No :( this is going to need another PR.

@@ -73,8 +74,10 @@ IMPROVEMENTS
* [x/stake] \#1815 Sped up the processing of `EditValidator` txs.
* [server] \#1930 Transactions indexer indexes all tags by default.
* [x/stake] \#2000 Added tests for new staking endpoints
* [tools] Make get_vendor_deps deletes `.vendor-new` directories, in case scratch files are present.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intended to be in this PR?

make get_vendor_deps
make build-linux
make localnet-start
docker run -it --network=host jackzampolin/gaiad-poll:latest ./poll.sh 40 5 10 localhost
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still am not a fan of this. You're right that it's just in CI, which we don't give a trusted role (presently), but it's hard to debug - now if something breaks where do I go to figure out what's in your Docker image?

Tried going to https://hub.docker.com/r/jackzampolin/gaiad-poll/ but that doesn't appear to have a Dockerfile

Can we just run the poll script natively in CI?

@jackzampolin
Copy link
Member Author

Closing this in favor of #2057

@jackzampolin jackzampolin deleted the jack/localnet-ci branch August 16, 2018 01:02
chillyvee pushed a commit to chillyvee/cosmos-sdk that referenced this pull request Mar 1, 2024
With Make 4.3+, the empty whitespace does not seem to work as
originally intended. This causes build tags to be "netgo ledger,"
on Ubuntu 22.04 and other systems that include the newer Make
version. The build tags were intended as "netgo,ledger" which
can be observed on Make 4.2 (shipped with Ubuntu 20.04).

This change swaps out the `+=` use in favor of an explicit `:=`.
Ref: https://www.gnu.org/software/make/manual/html_node/Appending.html

Closes cosmos/gaia#2017.

Co-authored-by: Marius Poke <marius.poke@posteo.de>
Co-authored-by: Milan Mulji <98309852+mmulji-ic@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants