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

tests: cli_tests no longer call unsafe_reset_all on local env #1538

Merged
merged 8 commits into from
Jul 5, 2018

Conversation

ValarDragon
Copy link
Contributor

@ValarDragon ValarDragon commented Jul 4, 2018

  • Makes all cli tests use .test_gaiad, .test_gaiacli instead of the
    same directories as the default binaries
  • Abstracts alot of the functionality for setting up the server into
    a single function / file-wide constants. This is to reduce
    code duplication, especially since some of this functionality
    depends on each test setting up the keys in the same way.

Closes #1461, #1557

  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGELOG.md
  • Updated Gaia/Examples
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)
  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)

* Makes all cli tests use .test_gaiad, .test_gaiacli instead of the
	same directories as the default binaries
* Abstracts alot of the functionality for setting up the server into
	a single function / file-wide constants. This is to reduce
	code duplication, especially since some of this functionality
	depends on each test setting up the keys in the same way.

Closes #1461
@ValarDragon
Copy link
Contributor Author

Note, even though cli tests are broken, this can still be tested locally. (Just check that the last block signed in your priv_validator.json stays the same after running the cli tests)

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

utACK

if err != nil {
log.Fatal(err)
}
// Users home directory
Copy link
Contributor

Choose a reason for hiding this comment

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

Think this comment is redundant 👍

@codecov
Copy link

codecov bot commented Jul 4, 2018

Codecov Report

Merging #1538 into develop will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff            @@
##           develop    #1538   +/-   ##
========================================
  Coverage    64.44%   64.44%           
========================================
  Files          118      118           
  Lines         6508     6508           
========================================
  Hits          4194     4194           
  Misses        2064     2064           
  Partials       250      250

@cwgoes cwgoes changed the base branch from unstable to develop July 4, 2018 19:21
cwgoes
cwgoes previously requested changes Jul 4, 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.

Can we use a temporary directory instead of the user's home directory?

// helper methods

func getTestingHomeDirs() (string, string) {
usr, err := user.Current()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to put this in the user's home directory? Can we use a standard temp directory - os.TempDir - or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, will change

proc = tests.GoExecuteTWithStdout(t, fmt.Sprintf("gaiad start --home=%s --rpc.laddr=%v", gaiadHome, servAddr))

return flags, port, proc
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Yo so although I like the idea of clumping some common functionality - I think we should be more verbose for these tests and expand this function BACK to the TestXxxs - The reason being is that these CLI tests have been designed to be readable like a script, I think it it's a step in the wrong direction abstracting anything out from the main test file which contains CLI tests - somebody should be able to just look at the test line-by-line and replicate it's functionality it the CLI

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will revert, thanks! Thats a good point I hadn't considered.

This is done to enhance readability, so one can easily reproduce
the functionality in the command line.
@rigelrozanski
Copy link
Contributor

Thanks! looking good -besides that CI is failing

@ValarDragon
Copy link
Contributor Author

ValarDragon commented Jul 5, 2018

Ok! So merging this is blocked until test_cli is fixed on develop?
EDIT: (I thought CLI tests were failing on develop previously. Forgot to run make install when I switched over to develop. Fixed them here though)

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.

utACK

@ValarDragon ValarDragon changed the title tests: cli_tests no longer reset call unsafe_reset_all on local env tests: cli_tests no longer call unsafe_reset_all on local env Jul 5, 2018
@cwgoes cwgoes dismissed rigelrozanski’s stale review July 5, 2018 21:09

Requested changes were made.

@cwgoes cwgoes merged commit fef2ff0 into develop Jul 5, 2018
@cwgoes cwgoes deleted the dev/isolate_cli_tests branch July 5, 2018 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants