-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cdf9d99
commit 3e8d11d
Showing
16 changed files
with
550 additions
and
7 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 |
---|---|---|
@@ -1 +1,3 @@ | ||
REACT_APP_FOREMAN_URL=http://localhost:5000 | ||
REACT_APP_GRAPHQL_API_URL="${REACT_APP_FOREMAN_URL}/api/graphql" | ||
REACT_APP_SETTINGS_FILE=production |
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,113 @@ | ||
--- | ||
name: CI | ||
on: [push, pull_request] | ||
env: | ||
SEED_ADMIN_PASSWORD: password | ||
SEED_LOCATION: "LAN" | ||
SEED_ORGANIZATION: "Organization 1" | ||
RAILS_ENV: development | ||
DATABASE_URL: postgresql://postgres:@localhost/test | ||
DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL: true | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres:12.1 | ||
ports: ['5432:5432'] | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
strategy: | ||
fail-fast: true | ||
max-parallel: 2 | ||
matrix: | ||
foreman-core-branch: [2.5-stable, develop] | ||
foreman-puppet-branch: [null, master] | ||
ruby-version: [2.7] | ||
node-version: [12.x] | ||
exclude: | ||
- foreman-core-branch: 2.5-stable | ||
foreman-puppet-branch: master | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
path: lisa | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: theforeman/foreman | ||
ref: ${{ matrix.foreman-core-branch }} | ||
path: foreman | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: theforeman/foreman_puppet | ||
ref: ${{ matrix.foreman-puppet-branch }} | ||
path: foreman_puppet | ||
if: ${{ matrix.foreman-puppet-branch != null }} | ||
- name: Setup foreman_puppet | ||
if: ${{ matrix.foreman-puppet-branch != null }} | ||
run: | | ||
echo "gem 'foreman_puppet', path: '../foreman_puppet'" > bundler.d/foreman_puppet.local.rb | ||
working-directory: foreman | ||
- name: Run Mocked Smart Proxy | ||
run: docker run -d --env MAIN_APP_FILE='app.rb' -p 8800:80 -v /home/runner/work/lisa/lisa/lisa/e2e/smart-proxy:/usr/src/app erikap/ruby-sinatra | ||
- uses: nanasess/setup-chromedriver@master | ||
- run: | | ||
export DISPLAY=:99 | ||
chromedriver --url-base=/wd/hub & | ||
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional | ||
- run: | | ||
sudo apt-get update | ||
sudo apt-get install build-essential libcurl4-openssl-dev libvirt-dev ruby-libvirt zlib1g-dev libpq-dev | ||
- name: Setup Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby-version }} | ||
- name: Install bundler | ||
run: gem install bundler | ||
- name: Copy lisa settings (puppet plugin enabled) | ||
if: ${{ matrix.foreman-puppet-branch != null }} | ||
run: cp e2e/production.json.with_puppet_plugin src/settings/production.json | ||
working-directory: lisa | ||
- name: Copy lisa settings (puppet plugin disabled) | ||
if: ${{ matrix.foreman-puppet-branch == null }} | ||
run: cp e2e/production.json.without_puppet_plugin src/settings/production.json | ||
working-directory: lisa | ||
- name: Build Lisa | ||
run: docker build -t lisa-image . | ||
working-directory: lisa | ||
- name: Run Lisa | ||
run: docker run -d -p 8080:8080 lisa-image | ||
working-directory: lisa | ||
- name: Cache Foreman gems | ||
uses: actions/cache@v2 | ||
with: | ||
path: foreman/vendor/bundle | ||
key: ${{ runner.os }}-gems-${{ hashFiles('foreman/Gemfile.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-gems- | ||
- name: Copy the Lisa specific configs to Foreman | ||
run: cp -r lisa/e2e/foreman ./ | ||
- name: Setup Foreman | ||
run: | | ||
bundle config path vendor/bundle | ||
bundle config set without journald development console mysql2 sqlite | ||
bundle install --jobs 4 --retry 3 | ||
bundle lock --update | ||
bundle exec rake db:create | ||
bundle exec rake db:migrate | ||
bundle exec rake db:seed | ||
working-directory: foreman | ||
- name: Cache gems | ||
uses: actions/cache@v2 | ||
with: | ||
path: foreman/vendor/bundle | ||
key: ${{ runner.os }}-gems-${{ hashFiles('foreman/Gemfile.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-gems- | ||
- name: Run Foreman | ||
run: bundle exec rails server -d -p 5000 | ||
working-directory: foreman | ||
- name: Run tests | ||
run: | | ||
bundle install | ||
bundle exec rake test | ||
working-directory: lisa/e2e |
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,2 @@ | ||
smart-proxy/.bundle | ||
screenshots |
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,8 @@ | ||
# frozen_string_literal: true | ||
|
||
source "https://rubygems.org" | ||
|
||
gem 'rake' | ||
gem 'minitest' | ||
gem 'selenium-webdriver' | ||
gem 'pry' |
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,28 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
childprocess (3.0.0) | ||
coderay (1.1.3) | ||
method_source (1.0.0) | ||
minitest (5.14.4) | ||
pry (0.14.1) | ||
coderay (~> 1.1) | ||
method_source (~> 1.0) | ||
rake (13.0.3) | ||
rubyzip (2.3.0) | ||
selenium-webdriver (3.142.7) | ||
childprocess (>= 0.5, < 4.0) | ||
rubyzip (>= 1.2.2) | ||
|
||
PLATFORMS | ||
ruby | ||
x86_64-darwin-18 | ||
|
||
DEPENDENCIES | ||
minitest | ||
pry | ||
rake | ||
selenium-webdriver | ||
|
||
BUNDLED WITH | ||
2.1.4 |
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,7 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rake/testtask' | ||
|
||
Rake::TestTask.new do |t| | ||
t.pattern = 'tests/*_test.rb' | ||
end |
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,51 @@ | ||
Fog.mock! | ||
|
||
module VmwareExtensions | ||
extend ActiveSupport::Concern | ||
|
||
module Overrides | ||
def client | ||
super.tap do |c| | ||
def c.data | ||
@data ||= begin | ||
super.tap do |super_data| | ||
super_data[:networks].map do |k, v| | ||
v['name'] = 'VM Network' | ||
v["vlanid"] = 1 | ||
end | ||
end.nested_under_indifferent_access | ||
end | ||
|
||
@data | ||
end | ||
end | ||
end | ||
end | ||
|
||
included do | ||
prepend Overrides | ||
end | ||
end | ||
|
||
::Foreman::Model::Vmware.include(VmwareExtensions) | ||
|
||
module CreateVmExtensions | ||
extend ActiveSupport::Concern | ||
|
||
module Overrides | ||
def create_vm(attributes = {}) | ||
super.tap do |id| | ||
data[:servers][id]['interfaces'].first['mac'] = 6.times.map { '%02x' % rand(0..255) }.join(':') | ||
end | ||
end | ||
end | ||
|
||
included do | ||
prepend Overrides | ||
end | ||
end | ||
|
||
require File.join(Gem::Specification.find_by_name('fog-vsphere').gem_dir, 'lib', 'fog', 'vsphere', 'requests', 'compute', 'create_vm.rb') | ||
|
||
Fog::Vsphere::Compute::Mock.include(CreateVmExtensions) | ||
|
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,4 @@ | ||
--- | ||
# :unattended: false | ||
:cors_domains: | ||
- '*' |
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,50 @@ | ||
all_locations = Location.all | ||
all_organizations = Organization.all | ||
|
||
smart_proxy = SmartProxy.create!( | ||
name: 'SmartProxyLisa', | ||
url: 'http://localhost:8800', | ||
locations: all_locations, | ||
organizations: all_organizations | ||
).tap do |smart_proxy| | ||
PuppetClassImporter.new({ url: smart_proxy.url }).changes['new'].map do |key, value| | ||
PuppetClassImporter.new.send(:add_classes_to_foreman, key, value) | ||
end | ||
end | ||
|
||
domain = Domain.create!( | ||
name: 'development.example.com', | ||
locations: all_locations, | ||
organizations: all_organizations | ||
).tap do |domain| | ||
domain.subnets.create!( | ||
name: 'SubnetLisa', | ||
network: '127.0.0.1', | ||
mask: '255.255.255.0', | ||
vlanid: 1, | ||
locations: all_locations, | ||
organizations: all_organizations | ||
) | ||
end | ||
|
||
ComputeResource.create!( | ||
name: 'ComputeResourceLisa ', | ||
provider: 'Vmware', | ||
uuid: 'Solutions', | ||
url: 'http://localhost:8283', | ||
user: 'user', | ||
password: 'password', | ||
http_proxy_id: smart_proxy.id, | ||
domain: domain, | ||
caching_enabled: false, | ||
locations: all_locations, | ||
organizations: all_organizations | ||
) | ||
|
||
Operatingsystem.create!( | ||
name: 'OSLisa', | ||
major: 1, | ||
media: Medium.all, | ||
ptables: Ptable.all, | ||
architectures: Architecture.all | ||
) |
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,73 @@ | ||
{ | ||
"form_settings": { | ||
"default_values": { | ||
"puppet_env_id": "MDE6Rm9yZW1hblB1cHBldDo6RW52aXJvbm1lbnQtMQ==", | ||
"puppetclass_ids": [ | ||
"MDE6Rm9yZW1hblB1cHBldDo6UHVwcGV0Y2xhc3MtMQ==" | ||
] | ||
} | ||
}, | ||
"default_configs": { | ||
"organization_id": "MDE6T3JnYW5pemF0aW9uLTE=", | ||
"architecture_id": "MDE6QXJjaGl0ZWN0dXJlLTE=" | ||
}, | ||
"locations": [ | ||
{ | ||
"id": "MDE6TG9jYXRpb24tMg==", | ||
"name": "LAN", | ||
"code": "LAN", | ||
"location": "LAN", | ||
"country": "de", | ||
"domain_name": "example.com", | ||
"label": { | ||
"location": "Karlsruhe", | ||
"explanation": "Datacenter 1 (LAN)", | ||
"reduced_performance": false | ||
}, | ||
"relations": { | ||
"cluster": "CLUSTER", | ||
"compute_resource_id": "MDE6Q29tcHV0ZVJlc291cmNlLTE=", | ||
"puppet_ca_proxy_id": "MDE6U21hcnRQcm94eS0x", | ||
"media": [ | ||
{ | ||
"id": "MDE6TWVkaXVtLTE=", | ||
"operatingsystem_id": "MDE6T3BlcmF0aW5nc3lzdGVtLTE=" | ||
} | ||
] | ||
}, | ||
"datastore_types": [ | ||
{ | ||
"id": "Mirror", | ||
"name": "Mirror", | ||
"template": "#DC#-LAN" | ||
} | ||
], | ||
"compute_attributes": { | ||
"path_prefix": "/Datencenter/LAN/vm/Linux/" | ||
} | ||
} | ||
], | ||
"operatingsystems": [ | ||
{ | ||
"id": "MDE6T3BlcmF0aW5nc3lzdGVtLTE=", | ||
"name": "OSLisa", | ||
"relations": { | ||
"guest_operatingsystem_id": "rhel7_64Guest", | ||
"ptable_id": "MDE6UHRhYmxlLTEyOQ==" | ||
} | ||
} | ||
], | ||
"app_tiers": [ | ||
{ | ||
"name": "development", | ||
"relations": { | ||
"locations": [ | ||
{ | ||
"code": "LAN", | ||
"resource_pool": "default" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
Oops, something went wrong.