Skip to content

Migrate smoke tests to RSpec #170

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

Closed
dmke opened this issue Oct 12, 2016 · 5 comments
Closed

Migrate smoke tests to RSpec #170

dmke opened this issue Oct 12, 2016 · 5 comments
Assignees

Comments

@dmke
Copy link
Contributor

dmke commented Oct 12, 2016

As mentioned in #152 (comment), the smoke tests in the smoke/ directory are in need of improvement.

Currently, the smoke test suite is simply a collection of Ruby files, which are executed in the smoke Rake task. meaning any of the expected goodies like a set up/tear down mechanism, assertions simply don't exist. To get around this, the smoke/noaa-sample-data.rb has a test_case method, which is more of a bad joke...

This hacky solution exists, because I didn't want to run the smoke tests, when a user simply executes rake or rspec in the Gem's root directory, but only when certain conditions are met (like ENV["travis"] == "true" indicating a CI server), and because filtering the file list in the specs/spec_helper.rb was even more of an adventure.

In retrospect, an .rspec file with an --exclude pattern might have been enough.


Your task, should you choose to accept it, would be:

  • moving the smoke test files from smoke/ to specs/smoke/ and converting them to RSpec specs
  • moving the smoke/provision.sh to a more appropriate place (root dir would be okay, I guess)
  • finding a way to automatically exclude spec/smoke/**/*.rb when invoking any of these commands:
    • rake and rake spec
    • rspec and rspec ./spec
      This should generate a visible warning when ENV["travis"] != "true" (and not run the smoke tests):
    • rspec ./spec/**/* or rspec ./spec/smoke

You will probably need/want to run the smoke tests on your local machine. To do that, install a current version of InfluxDB locally, and create the following users and databases (this is extracted from the smoke/provision.sh:

CREATE USER root WITH PASSWORD 'toor' WITH ALL PRIVILEGES
CREATE USER test_user WITH PASSWORD 'resu_tset'
CREATE DATABASE db_one
CREATE DATABASE db_two
GRANT ALL ON db_two TO test_user
GRANT ALL ON NOAA_water_database TO test_user

Then download and import the NOAA sample data set:

curl https://s3-us-west-1.amazonaws.com/noaa.water.database.0.9/NOAA_data.txt > noaa.txt
influx -import -path noaa.txt -precision s

and enable HTTP authentication in /etc/influxdb/influxdb.conf (auth-enabled = true in the [http] section). Finally restart the server (systemctl restart influxd.service on Debian)

@TheKaterTot
Copy link
Contributor

I'd like to work on this. Are there any updates I need to know about? It seems relatively straightforward.

@dmke
Copy link
Contributor Author

dmke commented Dec 11, 2017

Hey, thanks for taking this on :-)

I don't believe there are any major updates impacting this task. Do you have/want write access to this repo?

@TheKaterTot
Copy link
Contributor

I don't have write access, but that would be great.

@dmke
Copy link
Contributor Author

dmke commented Dec 11, 2017

You should now be able to push into this repo.

Let me know if you're stuck.

@TheKaterTot
Copy link
Contributor

Merged! Thanks @dmke

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants