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

Make it easier to implement e2e specs #40

Open
nickthecook opened this issue Aug 28, 2020 · 1 comment
Open

Make it easier to implement e2e specs #40

nickthecook opened this issue Aug 28, 2020 · 1 comment

Comments

@nickthecook
Copy link
Owner

There are a few things that make implementing an e2e spec more work and less DRY than it should be.

This is an example:

RSpec.describe "ssh key with passphrase var" do
  include_context "ops e2e"

  before(:all) do
    Dir.chdir(__dir__)

    remove_untracked_files

    @output, @output_file, @exit_status = run_ops("../../../../bin/ops up")
  end

  # actual tests goes here
end

Things that could be improved:

  • doing a chdir: must be done in every spec, correctly, or the tests will run with a) no ops.yml or b) worse: the wrong ops.yml
  • removing untracked files: must be done in every spec (so far; maybe someday a spec won't need it)
  • setting local variables: I'm not sure how legit this is to do in an rspec spec; maybe there's a better way
  • knowing the path back to the ops installation: maybe a method in "ops e2e" context could handle this, if you pass an array like ["up", "my_action", "down"]

Basically, having to copy and paste this block to every spec and tweaking the path to bin/ops is not ideal.

@nickthecook
Copy link
Owner Author

This allows multiple ops commands to be tested in a single spec file, but it's a total hack:

@output1, @output_file1, @exit_status1 = run_ops("../../../bin/ops app action_one")

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

No branches or pull requests

1 participant