Skip to content

Commit 57b22b2

Browse files
author
jordanbreen28
committed
Further acceptance test fix
1 parent b6c056b commit 57b22b2

9 files changed

+63
-42
lines changed

.fixtures.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ fixtures:
44
puppet_agent: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git'
55
provision: 'https://github.com/puppetlabs/provision.git'
66
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
7+
mount_iso: 'https://github.com/puppetlabs/puppetlabs-mount_iso.git'
8+
archive: 'https://github.com/voxpupuli/puppet-archive.git'
79
symlinks:
810
sqlserver: "#{source_dir}"

.github/workflows/nightly.yml

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,13 @@ env:
1111

1212
jobs:
1313
setup_matrix:
14-
if: ${{ github.repository_owner == 'puppetlabs' }}
1514
name: "Setup Test Matrix"
1615
runs-on: ubuntu-20.04
1716
outputs:
1817
matrix: ${{ steps.get-matrix.outputs.matrix }}
1918

2019
steps:
2120

22-
- name: "Connect to twingate"
23-
uses: twingate/github-action@v1
24-
with:
25-
service-key: ${{ secrets.TWINGATE_PUBLIC_REPO_KEY }}
26-
2721
- name: "Honeycomb: Start recording"
2822
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
2923
with:
@@ -35,6 +29,7 @@ jobs:
3529
run: |
3630
echo STEP_ID=setup-environment >> $GITHUB_ENV
3731
echo STEP_START=$(date +%s) >> $GITHUB_ENV
32+
3833
- name: Checkout Source
3934
uses: actions/checkout@v2
4035
if: ${{ github.repository_owner == 'puppetlabs' }}
@@ -52,31 +47,33 @@ jobs:
5247
echo ::group::bundler environment
5348
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
5449
echo ::endgroup::
55-
50+
5651
- name: "Honeycomb: Record Setup Environment time"
5752
if: ${{ github.repository_owner == 'puppetlabs' }}
5853
run: |
5954
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
6055
echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV
6156
echo STEP_START=$(date +%s) >> $GITHUB_ENV
57+
6258
- name: Setup Acceptance Test Matrix
6359
id: get-matrix
64-
if: ${{ github.repository_owner == 'puppetlabs' }}
6560
run: |
6661
if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then
67-
buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2
62+
buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2
6863
else
6964
echo "::set-output name=matrix::{}"
7065
fi
71-
66+
7267
- name: "Honeycomb: Record Setup Test Matrix time"
7368
if: ${{ always() }}
7469
run: |
7570
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix'
71+
7672
Acceptance:
7773
name: "${{matrix.platforms.label}}, ${{matrix.collection}}"
7874
needs:
7975
- setup_matrix
76+
if: ${{ needs.setup_matrix.outputs.matrix != '{}' }}
8077

8178
runs-on: ubuntu-20.04
8279
strategy:
@@ -92,7 +89,6 @@ jobs:
9289
echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE
9390
echo 'label=${{ matrix.platforms.label }}' >> $BUILDEVENT_FILE
9491
95-
9692
- name: "Honeycomb: Start recording"
9793
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
9894
with:
@@ -130,7 +126,12 @@ jobs:
130126
131127
- name: Provision test environment
132128
run: |
133-
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platforms.image }}' -- bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]'
129+
if [[ "${{matrix.platforms.provider}}" == "provision::docker" ]]; then
130+
DOCKER_RUN_OPTS="docker_run_opts: {'--volume': '/lib/modules/$(uname -r):/lib/modules/$(uname -r)'}"
131+
else
132+
DOCKER_RUN_OPTS=''
133+
fi
134+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platforms.image }}' -- bundle exec rake "litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }},$DOCKER_RUN_OPTS]"
134135
echo ::group::=== REQUEST ===
135136
cat request.json || true
136137
echo
@@ -154,6 +155,20 @@ jobs:
154155
run: |
155156
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module'
156157
158+
- name: Authenitcate with GCP
159+
run: |
160+
bundle exec bolt command run 'cd C:\\; Set-Content -Path .\creds.json -Value @"
161+
${{ secrets.GCP_CONNECTION }}
162+
"@; gcloud auth activate-service-account --key-file "creds.json"' --targets winrm_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
163+
164+
- name: Download OS ISO
165+
run: |
166+
bundle exec bolt command run 'Start-Process -FilePath "powershell" -Wait -ArgumentList "cd C://; gsutil cp gs://artifactory-modules/windows/en_windows_server_2019_updated_july_2020_x64_dvd_94453821.iso .\"' --targets winrm_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
167+
168+
- name: Download SQLServer ISO
169+
run: |
170+
bundle exec bolt command run 'Start-Process -FilePath "powershell" -Wait -ArgumentList "cd C://; gsutil cp gs://artifactory-modules/puppetlabs-sqlserver/SQLServer2019CTP2.4-x64-ENU.iso .\"' --targets winrm_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
171+
157172
- name: "Honeycomb: Record deployment times"
158173
if: ${{ always() }}
159174
run: |
@@ -190,20 +205,3 @@ jobs:
190205
if: ${{ always() }}
191206
run: |
192207
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Remove test environment'
193-
194-
slack-workflow-status:
195-
if: ${{ github.repository_owner == 'puppetlabs' }}
196-
name: Post Workflow Status To Slack
197-
needs:
198-
- Acceptance
199-
runs-on: ubuntu-20.04
200-
steps:
201-
- name: Slack Workflow Notification
202-
uses: puppetlabs/Gamesight-slack-workflow-status@pdk-templates-v1
203-
with:
204-
# Required Input
205-
repo_token: ${{ secrets.GITHUB_TOKEN }}
206-
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK }}
207-
# Optional Input
208-
channel: '#team-cat-bots'
209-
name: 'GABot'

.github/workflows/pr_test.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ jobs:
1414
matrix: ${{ steps.get-matrix.outputs.matrix }}
1515

1616
steps:
17-
18-
- name: "Connect to twingate"
19-
uses: twingate/github-action@v1
20-
with:
21-
service-key: ${{ secrets.TWINGATE_PUBLIC_REPO_KEY }}
2217

2318
- name: "Honeycomb: Start recording"
2419
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
@@ -157,6 +152,20 @@ jobs:
157152
run: |
158153
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module'
159154
155+
- name: Authenitcate with GCP
156+
run: |
157+
bundle exec bolt command run 'cd C:\\; Set-Content -Path .\creds.json -Value @"
158+
${{ secrets.GCP_CONNECTION }}
159+
"@; gcloud auth activate-service-account --key-file "creds.json"' --targets winrm_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
160+
161+
- name: Download OS ISO
162+
run: |
163+
bundle exec bolt command run 'Start-Process -FilePath "powershell" -Wait -ArgumentList "cd C://; gsutil cp gs://artifactory-modules/windows/en_windows_server_2019_updated_july_2020_x64_dvd_94453821.iso .\"' --targets winrm_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
164+
165+
- name: Download SQLServer ISO
166+
run: |
167+
bundle exec bolt command run 'Start-Process -FilePath "powershell" -Wait -ArgumentList "cd C://; gsutil cp gs://artifactory-modules/puppetlabs-sqlserver/SQLServer2019CTP2.4-x64-ENU.iso .\"' --targets winrm_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
168+
160169
- name: "Honeycomb: Record deployment times"
161170
if: ${{ always() }}
162171
run: |
@@ -169,7 +178,7 @@ jobs:
169178
- name: Run acceptance tests
170179
run: |
171180
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:acceptance:parallel' -- bundle exec rake 'litmus:acceptance:parallel'
172-
181+
173182
- name: "Honeycomb: Record acceptance testing times"
174183
if: ${{ always() }}
175184
run: |

spec/acceptance/sqlserver_config_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
describe 'sqlserver::config test' do
1313
def ensure_sqlserver_instance(inst_name, ensure_val = 'present')
14+
user = Helper.instance.run_shell('$env:UserName').stdout.chomp
1415
pp = <<-MANIFEST
1516
sqlserver_instance{'#{inst_name}':
1617
ensure => '#{ensure_val}',
@@ -54,7 +55,7 @@ def ensure_sqlserver_instance(inst_name, ensure_val = 'present')
5455
instance => '#{inst_name}',
5556
login_type => 'SQL_LOGIN',
5657
login => '#{@admin_user}',
57-
password => Sensitive('#{@admin_pass}'),
58+
password => '#{@admin_pass}',
5859
svrroles => {'sysadmin' => 1},
5960
}
6061
MANIFEST

spec/acceptance/sqlserver_database_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def run_sql_query_opts(query, expected_row_count)
4747
}
4848
sqlserver_tsql{'testsqlserver_tsql':
4949
instance => 'MSSQLSERVER',
50-
command => "use #{@db_name};CREATE TABLE #{@table_name} (id INT, name VARCHAR(20), email VARCHAR(20));",
50+
command => "use #{@db_name}; CREATE TABLE #{@table_name} (id INT, name VARCHAR(20), email VARCHAR(20));",
5151
require => Sqlserver::Database['#{@db_name}'],
5252
}
5353
MANIFEST

spec/acceptance/sqlserver_instance_spec.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ def new_random_instance_name
1212
version = sql_version?
1313

1414
def ensure_sqlserver_instance(features, inst_name, ensure_val = 'present', sysadmin_accounts = "['vagrant']")
15+
user = Helper.instance.run_shell('$env:UserName').stdout.chomp
16+
password = Helper.instance.run_shell('[System.Net.CredentialCache]::DefaultNetworkCredentials.Password').stdout.chomp
1517
pp = <<-MANIFEST
1618
sqlserver_instance{'#{inst_name}':
1719
name => '#{inst_name}',
@@ -20,7 +22,7 @@ def ensure_sqlserver_instance(features, inst_name, ensure_val = 'present', sysad
2022
security_mode => 'SQL',
2123
sa_pwd => 'Pupp3t1@',
2224
features => #{features},
23-
sql_sysadmin_accounts => #{sysadmin_accounts},
25+
sql_sysadmin_accounts => ['vagrant'],
2426
agt_svc_account => 'vagrant',
2527
agt_svc_password => 'vagrant',
2628
windows_feature_source => 'I:\\sources\\sxs',
@@ -78,15 +80,17 @@ def sql_query_is_user_sysadmin(username)
7880

7981
it "create #{inst_name} instance" do
8082
host_computer_name = run_shell('CMD /C ECHO %COMPUTERNAME%').stdout.chomp
83+
user = Helper.instance.run_shell('$env:UserName').stdout.chomp
8184
ensure_sqlserver_instance(features, inst_name, 'present', "['vagrant','#{host_computer_name}\\#{@extra_admin_user}']")
8285

8386
validate_sql_install(version: version) do |r|
8487
expect(r.stdout).to match(%r{#{Regexp.new(inst_name)}})
8588
end
8689
end
8790

88-
it "#{inst_name} instance has Administrator as a sysadmin" do
89-
run_sql_query(run_sql_query_opts(inst_name, sql_query_is_user_sysadmin('Administrator'), 1))
91+
it "#{inst_name} instance has vagrant as an Administrator" do
92+
user = Helper.instance.run_shell('$env:UserName').stdout.chomp
93+
run_sql_query(run_sql_query_opts(inst_name, sql_query_is_user_sysadmin(user), 1))
9094
end
9195

9296
it "#{inst_name} instance has ExtraSQLAdmin as a sysadmin" do

spec/acceptance/z_last_sqlserver_features_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
describe 'sqlserver_features', if: version.to_i != 2012 do
1010
def ensure_sql_features(features, ensure_val = 'present')
1111
hostname = Helper.instance.run_shell('hostname').stdout.upcase.strip
12+
user = Helper.instance.run_shell('$env:UserName').stdout.chomp
1213
pp = <<-MANIFEST
1314
sqlserver::config{ 'MSSQLSERVER':
1415
admin_pass => '#{SQL_ADMIN_USER}',
@@ -29,6 +30,7 @@ def ensure_sql_features(features, ensure_val = 'present')
2930

3031
def bind_and_apply_failing_manifest(features, ensure_val = 'present')
3132
hostname = Helper.instance.run_shell('hostname').stdout.upcase.strip
33+
user = Helper.instance.run_shell('$env:UserName').stdout.chomp
3234
pp = <<-MANIFEST
3335
sqlserver::config{ 'MSSQLSERVER':
3436
admin_pass => '#{SQL_ADMIN_USER}',
@@ -38,7 +40,6 @@ def bind_and_apply_failing_manifest(features, ensure_val = 'present')
3840
ensure => #{ensure_val},
3941
source => 'H:',
4042
is_svc_account => "#{hostname}\\\\vagrant",
41-
is_svc_password => 'vagrant',
4243
features => #{features},
4344
}
4445
MANIFEST
@@ -152,6 +153,7 @@ def bind_and_apply_failing_manifest(features, ensure_val = 'present')
152153
features = ['BC', 'Conn', 'SDK', 'IS', 'MDS', 'DQC']
153154

154155
def remove_sql_instance
156+
user = Helper.instance.run_shell('$env:UserName').stdout.chomp
155157
pp = <<-MANIFEST
156158
sqlserver_instance{'MSSQLSERVER':
157159
ensure => absent,

spec/spec_helper_acceptance_local.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class Helper
2929
file: WIN_2019_ISO,
3030
drive_letter: 'I',
3131
}
32+
3233
mount_iso(iso_opts)
3334

3435
base_install(sql_version?)
@@ -124,6 +125,7 @@ def base_install(sql_version)
124125
end
125126

126127
def install_sqlserver(features)
128+
user = Helper.instance.run_shell('$env:UserName').stdout.chomp
127129
# this method installs SQl server on a given host
128130
pp = <<-MANIFEST
129131
sqlserver_instance{'MSSQLSERVER':
@@ -145,7 +147,9 @@ def install_sqlserver(features)
145147
windows_feature_source => 'I:\\sources\\sxs',
146148
}
147149
MANIFEST
148-
Helper.instance.apply_manifest(pp)
150+
p pp
151+
p Helper.instance.apply_manifest(pp)
152+
pp Helper.instance.run_shell('more "C:\Program Files\Microsoft SQL Server\150\Setup Bootstrap\Log\Summary.txt"')
149153
end
150154

151155
def run_sql_query(opts = {}, &block)

spec/sql_testing_helpers.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def mount_iso(host, opts = {})
2222
end
2323

2424
def install_sqlserver(host, opts = {})
25+
user = Helper.instance.run_shell('$env:UserName').stdout.chomp
2526
# this method installs SQl server on a given host
2627
features = opts[:features].map { |x| "'#{x}'" }.join(', ')
2728
pp = <<-MANIFEST

0 commit comments

Comments
 (0)