Skip to content

Commit 8eddfcc

Browse files
committed
Update tests for connect server
1 parent e83d5b8 commit 8eddfcc

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

cookbooks/boxcutter_onepassword/kitchen.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ suites:
134134
echo "<%= ENV['OP_SERVICE_ACCOUNT_TOKEN'] %>" > /etc/cinc/op_service_account_token
135135
'
136136
137-
- name: connect-server
137+
- name: connect-server-cinc
138138
named_run_list: boxcutter_onepassword_test_connect_server
139139
verifier:
140140
inspec_tests:
@@ -152,12 +152,34 @@ suites:
152152
# export OP_CONNECT_HOST=http://localhost:8080
153153
pre_converge:
154154
- remote: |
155-
bash -xc '
156-
set +x
155+
bash -c '
157156
mkdir -p /etc/cinc
158-
ln -s /etc/cinc /etc/chef
157+
echo "<%= ENV['OP_CONNECT_HOST'] %>" > /etc/cinc/op_connect_host
158+
echo "<%= ENV['OP_CONNECT_TOKEN'] %>" > /etc/cinc/op_connect_token
159+
echo "<%= ENV['OP_SERVICE_ACCOUNT_TOKEN'] %>" > /etc/cinc/op_service_account_token
160+
'
161+
162+
- name: connect-server-chef
163+
named_run_list: boxcutter_onepassword_test_connect_server
164+
verifier:
165+
inspec_tests:
166+
- test/integration/cli
167+
attributes:
168+
lifecycle:
169+
# op item get 'Service Account Auth Token: automation-org-readonly-blue' --vault Automation-Org --account PB5KE5S2ORAQTDUOLBDJTLAPVU
170+
# op item get mzqlddelxv6oe7dfz3vc7iad7m --vault Automation-Org --account PB5KE5S2ORAQTDUOLBDJTLAPVU --format json
171+
# export OP_SERVICE_ACCOUNT_TOKEN=$(op read 'op://Automation-Org/mzqlddelxv6oe7dfz3vc7iad7m/credential' --account PB5KE5S2ORAQTDUOLBDJTLAPVU)
172+
#
173+
# op item get 'sandbox-connect-server Access Token: sandbox-rw-blue' --vault Automation-Org --account PB5KE5S2ORAQTDUOLBDJTLAPVU
174+
# op item get nuhhhrxxzz4cjmssx3226ejfzm --vault Automation-Org --account PB5KE5S2ORAQTDUOLBDJTLAPVU --format json
175+
# export OP_CONNECT_TOKEN=$(op read 'op://Automation-Org/nuhhhrxxzz4cjmssx3226ejfzm/credential' --account PB5KE5S2ORAQTDUOLBDJTLAPVU)
176+
#
177+
# export OP_CONNECT_HOST=http://localhost:8080
178+
pre_converge:
179+
- remote: |
180+
bash -c '
181+
mkdir -p /etc/chef
159182
echo "<%= ENV['OP_CONNECT_HOST'] %>" > /etc/chef/op_connect_host
160183
echo "<%= ENV['OP_CONNECT_TOKEN'] %>" > /etc/chef/op_connect_token
161184
echo "<%= ENV['OP_SERVICE_ACCOUNT_TOKEN'] %>" > /etc/chef/op_service_account_token
162-
set -x
163-
'
185+
'

cookbooks/boxcutter_onepassword/test/cookbooks/boxcutter_onepassword_test/recipes/connect_server.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
'sandbox-connect-server Credentials File'
2525
node.default['boxcutter_onepassword']['connect_server']['onepassword_credentials']['vault'] = \
2626
'Automation-Org'
27-
include_recipe 'boxcutter_onepassword::connect_server'
27+
## This won't work in a dokken harness because can't do docker in docker
28+
# include_recipe 'boxcutter_onepassword::connect_server'
29+
30+
include_recipe 'boxcutter_onepassword::cli'
2831

2932
# There's no great ways to test these runtime functions that I know of.
3033
# Can't really use chefspec because it installs the 1Password CLI at
@@ -46,6 +49,7 @@
4649
fail 'Unable to read "craft SSH Key" - did you remember to set OP_CONNECT_TOKEN?'
4750
end
4851

52+
# op item get 'sandbox-connect-server Access Token: sandbox-rw-blue' --vault Automation-Org
4953
# export OP_API_TOKEN="<token>"
5054
# curl \
5155
# -H "Accept: application/json" \

0 commit comments

Comments
 (0)