Skip to content

Commit 6d8ea0c

Browse files
committed
test: fixed integration test to fail and pass email results as expected
Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
1 parent 0bab9c4 commit 6d8ea0c

File tree

1 file changed

+8
-9
lines changed
  • tests/integration/cases/email_checking_pypi_malware_analyzer

1 file changed

+8
-9
lines changed
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
#!/bin/bash
22
# Copyright (c) 2024 - 2025, Oracle and/or its affiliates. All rights reserved.
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
4-
if sqlite3 --json output/macaron.db "SELECT detect_malicious_metadata_check.detail_information
4+
result=$(sqlite3 --json output/macaron.db "SELECT detect_malicious_metadata_check.detail_information
55
FROM detect_malicious_metadata_check JOIN check_facts on detect_malicious_metadata_check.id = check_facts.id
66
JOIN check_result on check_facts.check_result_id = check_result.id JOIN component
77
ON component.id = check_result.component_id WHERE check_result.check_id = 'mcn_detect_malicious_metadata_1'
8-
AND component.name = 'smooth-operator'" | jq -r ".[0].detail_information | fromjson | .invalid_emails | length > 0"; then
9-
exit 0
10-
else
8+
AND component.name = 'smooth-operator'" | jq -r ".[0].detail_information | fromjson | .invalid_emails | length > 0")
9+
if [[ "$result" == "false" ]]; then
1110
echo "ERROR: the invalid_emails report for smooth-operator is empty" >&2
1211
exit 1
1312
fi
1413

15-
if sqlite3 --json output/macaron.db "SELECT detect_malicious_metadata_check.detail_information
14+
result=$(sqlite3 --json output/macaron.db "SELECT detect_malicious_metadata_check.detail_information
1615
FROM detect_malicious_metadata_check JOIN check_facts on detect_malicious_metadata_check.id = check_facts.id
1716
JOIN check_result on check_facts.check_result_id = check_result.id JOIN component
1817
ON component.id = check_result.component_id WHERE check_result.check_id = 'mcn_detect_malicious_metadata_1'
19-
AND component.name = 'email-validator'" | jq -r ".[0].detail_information | fromjson | .valid_emails | length > 0"; then
20-
exit 0
21-
else
18+
AND component.name = 'email-validator'" | jq -r ".[0].detail_information | fromjson | .valid_emails | length > 0")
19+
if [[ "$result" == "false" ]]; then
2220
echo "ERROR: the valid_emails report for email-validator is empty" >&2
23-
exit 1
21+
exit 2
2422
fi
23+
exit 0

0 commit comments

Comments
 (0)