Skip to content

Commit

Permalink
TEST
Browse files Browse the repository at this point in the history
  • Loading branch information
david22swan committed Jul 2, 2024
1 parent 0266a68 commit b4831ea
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 2 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# This is a generic workflow for gem Acceptance operations.
name: "Windows Acceptance"

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
workflow_dispatch:

jobs:
acceptance:
name: "acceptance"
runs-on: 'ubuntu-latest'

env:
PUPPET_GEM_VERSION: puppet8-nightly

steps:

- name: "checkout"
uses: "actions/checkout@v4"

- name: "export environment"
run: |
echo "PUPPET_VERSION=puppet8-nightly" >> $GITHUB_ENV
echo "PUPPET_GEM_VERSION=puppet8-nightly" >> $GITHUB_ENV
- name: "setup ruby"
uses: "ruby/setup-ruby@v1"
with:
ruby-version: '3.2'
bundler-cache: true

- name: "provision machine"
run: |
cat <<EOF > test_machines.json
{
"url": "https://api.github.com/repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID",
"VMs": [
{
"cloud": "gcp",
"images": ["windows-2019"]
}
]
}
EOF
curl -X POST -H "Authorization:bearer $TOKEN" https://facade-main-6f3kfepqcq-uc.a.run.app/v1/provision --data @test_machines.json > ./spec/fixtures/litmus_inventory.yaml
- name: "print inventory"
run: |
cat ./spec/fixtures/litmus_inventory.yaml
- name: "run acceptance"
run: |
function yaml2json() {
ruby -ryaml -rjson -e 'puts JSON.pretty_generate(YAML.load(ARGF))' $*
}
echo "Target Machine: $(yaml2json ./spec/fixtures/litmus_inventory.yaml | jq -r '.groups[2].targets[0].uri')"
TARGET_HOST=$(yaml2json ./spec/fixtures/litmus_inventory.yaml | jq -r '.groups[2].targets[0].uri') bundle exec rspec ./spec/acceptance/
# target=$(yaml2json ../inventory.yaml | jq -r '.groups[1].targets[0].uri')
# TARGET_HOST=35.185.225.136 bundle exec rspec ./spec/acceptance/
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ group :test do
end

group :acceptance do
gem 'minitar-cli'
# gem 'minitar-cli'
gem 'rspec-xsd'
gem 'serverspec'
end

group :acceptance_ci do
gem 'puppetlabs_spec_helper', '~> 7.0', require: false
gem 'puppet_litmus', '~> 1.0', require: false
end
2 changes: 1 addition & 1 deletion spec/acceptance/build_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
'template-ref' => 'heads/main-0-g1234abc'
}

context 'when the module has complete metadata' do
context "#{RbConfig::CONFIG['host_os']}" do

Check failure on line 24 in spec/acceptance/build_spec.rb

View workflow job for this annotation

GitHub Actions / spec (ruby 2.7) / spec

Style/RedundantInterpolation: Prefer `to_s` over string interpolation.

Check failure on line 24 in spec/acceptance/build_spec.rb

View workflow job for this annotation

GitHub Actions / spec (ruby 3.2) / spec

Style/RedundantInterpolation: Prefer `to_s` over string interpolation.
before(:all) do
File.open('metadata.json', 'w') do |f|
f.puts metadata.to_json
Expand Down
3 changes: 3 additions & 0 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
require 'pdk/util/template_uri'
require 'tempfile'
require 'json'
require 'puppet_litmus'

PuppetLitmus.configure!

# Sets default puppet/ruby versions to be used within the tests
# Duplicates of this are found within spec_helper.rb and spec_helper_package.rb and should be updated simultaneously.
Expand Down

0 comments on commit b4831ea

Please sign in to comment.