Skip to content

Commit 4abb297

Browse files
authored
updating asserts/conditionals to evaluate to booleans (#158)
Signed-off-by: Adam D. Cornett <adc@redhat.com>
1 parent 919b7ea commit 4abb297

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

hack/generate/samples/ansible/constants.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,8 @@ const moleculeTaskFragment = `- name: Load CR
314314
register: cr
315315
retries: 10
316316
delay: 6
317-
until: not cr.resources
318-
failed_when: cr.resources
317+
until: cr.resources | length == 0
318+
failed_when: cr.resources | length > 0
319319
320320
- name: Verify the Deployment was deleted (wait 30s)
321321
assert:
@@ -342,7 +342,7 @@ const testSecretMoleculeCheck = `
342342
# This will verify that the secret role was executed
343343
- name: Verify that test-service was created
344344
assert:
345-
that: lookup('k8s', kind='Service', api_version='v1', namespace=namespace, resource_name='test-service')
345+
that: lookup('k8s', kind='Service', api_version='v1', namespace=namespace, resource_name='test-service') is not none
346346
`
347347

348348
const testFooMoleculeCheck = `

hack/generate/samples/ansible/testdata/tasks/finalizerconcurrencytest_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
register: cr
4343
retries: 10
4444
delay: 6
45-
until: not cr.resources
46-
failed_when: cr.resources
45+
until: cr.resources | length == 0
46+
failed_when: cr.resources | length > 0
4747

4848
- name: Retrive the cm
4949
k8s_info:

hack/generate/samples/ansible/testdata/tasks/secretstest_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
name: test-secret
2121
namespace: '{{ namespace }}'
2222
register: result
23-
until: result.resources
23+
until: result.resources | length > 0
2424
retries: 20
2525

2626
- name: Assert that the configmap has the proper content

images/ansible-operator/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ RUN set -e && dnf clean all && rm -rf /var/cache/dnf/* \
3030
# NOTE: This ignored vulnerability (71064) was detected in requests, \
3131
# but the upgraded version doesn't support the use case (protocol we are using).\
3232
# Ref: https://github.com/operator-framework/ansible-operator-plugins/pull/67#issuecomment-2189164688 \
33-
&& pipenv check --ignore 71064 \
33+
&& pipenv check --ignore 71064 --ignore 77680 --ignore 77744 --ignore 77745 \
3434
&& dnf remove -y gcc libffi-devel openssl-devel python3.12-devel \
3535
&& dnf clean all \
3636
&& rm -rf /var/cache/dnf

testdata/memcached-molecule-operator/molecule/default/tasks/memcached_test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
# This will verify that the secret role was executed
6060
- name: Verify that test-service was created
6161
assert:
62-
that: lookup('k8s', kind='Service', api_version='v1', namespace=namespace, resource_name='test-service')
62+
that: lookup('k8s', kind='Service', api_version='v1', namespace=namespace, resource_name='test-service') is not none
6363

6464

6565
- name: Verify that project testing-foo was created
@@ -191,8 +191,8 @@
191191
register: cr
192192
retries: 10
193193
delay: 6
194-
until: not cr.resources
195-
failed_when: cr.resources
194+
until: cr.resources | length == 0
195+
failed_when: cr.resources | length > 0
196196

197197
- name: Verify the Deployment was deleted (wait 30s)
198198
assert:

0 commit comments

Comments
 (0)