-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automated tests with Github Actions (#24)
(cherry picked from commit 22aed97)
- Loading branch information
Showing
9 changed files
with
113 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Test | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
ruby-version: ['3.2'] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install | ||
run: ./install.sh | ||
|
||
- name: Configure | ||
run: cd ./tests && ./prepare.rb http://3.72.81.234:2633/RPC2 http://3.72.81.234:2474 0 1 | ||
|
||
# Maybe should be included in rspec | ||
- name: Start engine | ||
run: provision-engine-server start && sleep 2 | ||
|
||
- name: Test | ||
run: cd ./tests && rspec tests.rb | ||
|
||
# Maybe should be included in rspec | ||
- name: Stop engine engine | ||
run: provision-engine-server stop | ||
|
||
- name: Uninstall | ||
run: ./install.sh purge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
.vs* | ||
Gemfile.lock | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
:engine_endpoint: 'http://localhost:1337/' | ||
:engine_endpoint: 'http://localhost:1337/' # TODO: load from engine.conf | ||
:auth: 'oneadmin:opennebula' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env ruby | ||
require 'yaml' | ||
require 'tempfile' | ||
|
||
# How to use | ||
# ./prepare.rb http://one_host:2633/RPC2 http://one_host:2474 0 1 | ||
|
||
GEMS = ['rspec', 'rack-test'] # gems required for running the tests | ||
CONF_PATH = '/etc/provision-engine/engine.conf' | ||
|
||
def install_gems | ||
GEMS.each do |gem| | ||
system("sudo gem list -i #{gem} || sudo gem install #{gem}") | ||
end | ||
end | ||
|
||
def configure_engine(oned, oneflow, nature, nature_s3) | ||
config = YAML.load_file(CONF_PATH) | ||
|
||
# Update the values | ||
config[:one_xmlrpc] = oned if oned | ||
config[:oneflow_server] = oneflow if oneflow | ||
config[:mapping][:nature] = nature if nature | ||
config[:mapping][:"nature-s3"] = nature_s3 if nature_s3 | ||
|
||
tempfile = Tempfile.new('engine.conf') | ||
tempfile.write(config) | ||
tempfile.flush | ||
|
||
# Write back to the file | ||
File.open(tempfile, 'w') do |f| | ||
f.write(config.to_yaml) | ||
end | ||
|
||
system("sudo mv #{tempfile.path} #{CONF_PATH}") | ||
end | ||
|
||
endpoint_oned = ARGV[0] | ||
endpoint_oneflow = ARGV[1] | ||
nature = ARGV[2].to_i | ||
nature_s3 = ARGV[3].to_i | ||
|
||
install_gems | ||
configure_engine(endpoint_oned, endpoint_oneflow, nature, nature_s3) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters