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

Refactor integration tests #71

Merged
merged 24 commits into from Jun 6, 2019
Merged

Refactor integration tests #71

merged 24 commits into from Jun 6, 2019

Conversation

matchai
Copy link
Member

@matchai matchai commented May 30, 2019

Description

Don't be scared off by the number of files changed. I simply moved the test files, and GitHub doesn't play nicely. 😅

  • Create subcommands to be able to print modules independently
    • starship prompt will print the full prompt
    • starship module <MODULE_NAME> will print a specific module
      e.g. starship module python
    • Added --path flag to print the prompt or modules without being in a specific directory
    • Added --status flag to provide the status of the last command, instead of requiring it as an argument
  • Refactored integration tests to be end-to-end tests, since there was no way in integration tests to set the environment variables for a specific command, which was required for the username module
  • Moved e2e tests to tests/testsuite to allow for a single binary to be built
    • Tests will build/run faster
    • No more false positives for unused functions
  • Added tests for username
  • Removed codecov + tarpaulin 😢

Removing Codecov + tarpaulin
The decision was split between more thorough end-to-end testing or having code coverage tooling. For the time being, I think the confidence provided by e2e tests outweighs the value of having code coverage.

This may change if we find a reliable mocking solution that allows most of our tests to be integration tests.

Motivation and Context

Adding integration tests was difficult. Hopefully, this will be easier to maintain.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Screenshots (if appropriate):

How Has This Been Tested?

  • I have tested using MacOS
  • I have tested using Linux
  • I have tested using Windows

Checklist:

  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.

Matan Kushner added 3 commits May 30, 2019 19:23
- Replace the use of Segments directly with plain
colored text to check stdout
- Create temp files in /tmp instead of in $TEMPDIR
to ensure we have the necessary file permissions
@matchai matchai added the 🔧 maintenance Maintenance tasks, usually to do with documentation, CI, or project structure. label May 30, 2019
@matchai
Copy link
Member Author

matchai commented May 31, 2019

By updating tests to use the binary directly, I inadvertently made coverage instrumentation unable to catch our test runs. 🤦‍♂

Matan Kushner added 2 commits May 31, 2019 17:19
The decision right now comes down between more thorough end-to-end
testing or having code coverage tooling. For the time being, I
think the confidence provided by e2e tests outweighs the value of
having code coverage.

This may change if we find a reliable mocking solution that allows
most of our tests to be integration tests.
@starship starship deleted a comment from codecov bot May 31, 2019
@matchai matchai changed the title Improve test coverage Refactor integration tests May 31, 2019
@starship starship deleted a comment from codecov bot May 31, 2019
@matchai matchai marked this pull request as ready for review May 31, 2019 15:54
@matchai matchai requested a review from a team May 31, 2019 15:54
Copy link
Member

@Snuggle Snuggle left a comment

Choose a reason for hiding this comment

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

LGTM! ❤️ 😊

#[test]
#[ignore]
fn git_repo_root() -> io::Result<()> {
// TODO: Investigate why git repo related tests fail when the tempdir is within /tmp/...
Copy link
Member

Choose a reason for hiding this comment

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

I've noticed this with random software so often. If I put a file in /tmp, it just fails in some unexpected way. It can't be a permissions issue, I'm really not sure what causes this weirdness.

Sometimes I've stored images in /tmp and been unable to select them in applications. I'd love an explanation. 🤷‍♀️

@matchai matchai requested a review from Multimo June 1, 2019 11:50
@matchai matchai merged commit 8239fbd into master Jun 6, 2019
@matchai matchai deleted the improve-coverage branch June 6, 2019 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔧 maintenance Maintenance tasks, usually to do with documentation, CI, or project structure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants