-
Notifications
You must be signed in to change notification settings - Fork 478
E2E specs #698
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
E2E specs #698
Changes from 7 commits
dbd0b64
806b356
04f2949
b88922d
a2bc71c
8a4506e
f7a8850
66ba66e
0a63d11
be6230e
bc9a699
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| -c --order rand | ||
| -c --order rand --tag ~e2e |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,9 +14,9 @@ def name | |
| end | ||
|
|
||
| # :nocov: | ||
| def run | ||
| def run(*args) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is how run method is defined in |
||
| Rake.application = self | ||
| super | ||
| super(*args) | ||
| end | ||
| # :nocov: | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,14 +8,14 @@ class Pretty | |
| attr_reader :script | ||
|
|
||
| def initialize(script) | ||
| @script = script | ||
| @script = Shellwords.shellsplit(script) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was a bug I introduced in #686, E2E tests caught it. |
||
| @coathooks = 0 | ||
| end | ||
|
|
||
| def run # rubocop:disable Metrics/AbcSize, Metrics/MethodLength | ||
| exit_status = nil | ||
|
|
||
| Open3.popen3(script) do |_stdin, stdout, stderr, wait_thr| | ||
| Open3.popen3(*script) do |_stdin, stdout, stderr, wait_thr| | ||
| pid = wait_thr.pid | ||
|
|
||
| trap('INT') { handle_sigint(pid) } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'mina/git' | ||
|
|
||
| set :simulate, false | ||
| set :user, 'mina-ssh' | ||
| set :domain, '0.0.0.0' | ||
| set :port, 2222 | ||
| set :deploy_to, '/app' | ||
|
|
||
| set :repository, 'https://github.com/mina-deploy/mina.git' | ||
| set :branch, 'master' | ||
|
|
||
| set :identity_file, 'spec/e2e/ssh' | ||
|
|
||
| set :ssh_options, '-o StrictHostKeyChecking=no' | ||
|
|
||
| desc 'Deploys to the server' | ||
| task :e2e_deploy do | ||
| deploy do | ||
| invoke :'git:clone' | ||
| invoke :'deploy:link_shared_paths' | ||
| invoke :'deploy:cleanup' | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| version: '3.8' | ||
| services: | ||
| mina-ssh: | ||
| image: ghcr.io/linuxserver/openssh-server | ||
| container_name: mina-ssh | ||
| hostname: mina-ssh | ||
| environment: | ||
| - PUID=1000 | ||
| - PGID=1000 | ||
| - TZ=UTC | ||
| - PUBLIC_KEY | ||
| - SUDO_ACCESS=true | ||
| - USER_NAME=mina-ssh | ||
| ports: | ||
| - 2222:2222 | ||
| command: > | ||
| sh -c " | ||
| apk update && apk add git ruby && gem install bundler && | ||
| touch /tmp/ready.txt && | ||
| tail -f /dev/null | ||
| " |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| cd spec/e2e/ | ||
| chmod 600 ssh | ||
| PUBLIC_KEY="$(cat ssh.pub)" docker-compose up -d mina-ssh \ | ||
| && docker exec mina-ssh sh -c "while [ ! -f /tmp/ready.txt ]; do sleep 2; done" | ||
| cd - | ||
| [[ -z "${CI}" ]] && ssh-keygen -R \[0.0.0.0\]:2222 | ||
| bundle exec rspec --tag e2e --order defined | ||
| status=$? | ||
| cd spec/e2e | ||
| docker-compose down | ||
| exit $status |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'spec_helper' | ||
|
|
||
| # IMPORTANT: run only through e2e_run.sh script | ||
| describe 'E2E tests', :e2e, type: :rake do | ||
| before do | ||
| load_config 'e2e' | ||
| end | ||
|
|
||
| describe 'deploy without setup' do | ||
| it 'exits with an error message' do | ||
| expect do | ||
| rake.run(['e2e_deploy']) | ||
| end.to raise_error(SystemExit) | ||
| .and output(output_file('e2e_deploy_without_setup')).to_stdout | ||
| end | ||
| end | ||
|
|
||
| describe 'setup' do | ||
| it 'sets up directories' do | ||
| expect do | ||
| rake.run(['setup']) | ||
| end.to output(output_file('e2e_setup')).to_stdout | ||
| end | ||
| end | ||
|
|
||
| describe 'deploy after setup' do | ||
| it 'deploys the app' do | ||
| expect do | ||
| rake.run(['e2e_deploy']) | ||
| end.to output(output_file('e2e_deploy_after_setup')).to_stdout | ||
| end | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| -----BEGIN OPENSSH PRIVATE KEY----- | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usually this isn't safe to keep in repos, but I generated this key just for e2e purposes. |
||
| b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn | ||
| NhAAAAAwEAAQAAAQEAskzzKcHPV/0n84dIXUKO3q/s4MX8+R+ogsbbEr/XRo0e2BtEmD52 | ||
| VLEJczYaxICqTOmlOvyx0oWOSPbim6Cpq6YskbxVaUqYSdzafdRXmc3+6BSXgGZH3dHWYc | ||
| 2vQFx01PVRXdb4EwQBwmCLX7v7+/OxXVq5MHxxXNHblut2c//Udp53F5fVm3WgE3iTIpxL | ||
| 0h/0H25kaE0HyZrFhFdPItAu/owkOhra6yX1PE8vcyQRs7d9uWwd3n+odCjwhTJ3431PFJ | ||
| SyCSTCKbDGMIB44E85e6Vr4EK9Xjrxb6Zrc8ayg4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RqTZki3J+LcJ8CoET7DLA | ||
| EHPXqaNWyEuLRjrZx6CdlbVrZvoU4k4TftrRMq177DNP7WBCvha3eZhZg2EA4MVG2j2iP2 | ||
| VtXtEjdWHNYwHUBMj6IXDxQuAQvXsQPTQ4h2kt7GG5/Wdw2QAAAIEA0DoKl7jfsQMSn1LR | ||
| csvP3tIfmj6KqboetjFABLloKnxVa/tlJRTJHiuWgUZQ9sCyI4rYAnSfZS2uppDBHvn/9f | ||
| uOV8XPu7N3Vm/jP5E97JUGaJUjnNZWiWHxUAf9VM2r7x2V4VvEn98xDKSObciSz9rosXlJ | ||
| POFxW7iCkxhNkjsAAAANbWluYS1lMmUtdGVzdAECAwQFBg== | ||
| -----END OPENSSH PRIVATE KEY----- | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCyTPMpwc9X/Sfzh0hdQo7er+zgxfz5H6iCxtsSv9dGjR7YG0SYPnZUsQlzNhrEgKpM6aU6/LHShY5I9uKboKmrpiyRvFVpSphJ3Np91FeZzf7oFJeAZkfd0dZhza9AXHTU9VFd1vgTBAHCYItfu/v787FdWrkwfHFc0duW63Zz/9R2nncXl9WbdaATeJMinEvSH/QfbmRoTQfJmsWEV08i0C7+jCQ6GtrrJfU8Ty9zJBGzt325bB3ef6h0KPCFMnfjfU8UlLIJJMIpsMYwgHjgTzl7pWvgQr1eOvFvpmtzxrKDgYRf2OqmW2O6n29YqF0zuri+uQQra4KVga6ud8QD mina-e2e-test |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| (?m)Cloning the Git repository.*Done\. Deployed version 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| The directory '/app/releases' does not exist on the server\. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Setting up /app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't run E2E tests on Mac because it doesn't come with docker, see actions/runner-images#17.