From 3c425f32c5f05b78ad88576dd68d41c7e112abca Mon Sep 17 00:00:00 2001 From: sievdokymov-virtru Date: Tue, 21 Apr 2026 12:07:25 +0300 Subject: [PATCH 1/7] improvements-manual trigger,color,prefix,ids --- .github/workflows/ci.yaml | 10 +++++++++- e2e/action.yaml | 2 ++ .../testname-to-testrail-id.virtru.json | 10 +++++++++- .../upload-bats-test-results-to-testrail.sh | 19 +++++++++++++------ 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 28266de0..b226c5ff 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,8 +5,15 @@ on: push: branches: - main + - ab-2168-otdfctl-manual-trigger schedule: - cron: "45 0 * * *" + workflow_dispatch: + inputs: + testrail-run-name-for-cli-test: + description: 'Name for the TestRail test run' + required: false + default: '' jobs: govulncheck: @@ -62,7 +69,8 @@ jobs: platform-ref: "main" - uses: opentdf/otdfctl/e2e@main with: - otdfctl-ref: ${{ github.event.pull_request.head.sha }} + otdfctl-ref: ${{ github.event.pull_request.head.sha || github.sha }} + testrail-run-name-for-cli-test: ${{ inputs.testrail-run-name-for-cli-test }} env: TESTRAIL_USER: ${{ secrets.TESTRAIL_USER }} TESTRAIL_PASS: ${{ secrets.TESTRAIL_PASS }} diff --git a/e2e/action.yaml b/e2e/action.yaml index 7f6c0042..89c1b370 100644 --- a/e2e/action.yaml +++ b/e2e/action.yaml @@ -80,6 +80,7 @@ runs: name: bats-test-results path: otdfctl/e2e/bats-results.tap - name: Integrate Bats test results into TestRail + if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' shell: bash working-directory: otdfctl run: | @@ -93,6 +94,7 @@ runs: TESTRAIL_PASS: ${{ env.TESTRAIL_PASS }} TESTRAIL_CLI_RUN_NAME: ${{ inputs.testrail-run-name-for-cli-test }} - name: Upload TestRail mapping report + if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' uses: actions/upload-artifact@v4 with: name: test-cases-mapping-report diff --git a/e2e/testrail-integration/samples-for-virtru-instance/testname-to-testrail-id.virtru.json b/e2e/testrail-integration/samples-for-virtru-instance/testname-to-testrail-id.virtru.json index 60c0402b..ecc0cc93 100644 --- a/e2e/testrail-integration/samples-for-virtru-instance/testname-to-testrail-id.virtru.json +++ b/e2e/testrail-integration/samples-for-virtru-instance/testname-to-testrail-id.virtru.json @@ -192,7 +192,8 @@ "Unsafe reactivate namespace": "C793449", "List namespaces - when reactivated": "C793450", "Unsafe delete namespace": "C793451", - "List namespaces - when deleted": "C793452" + "List namespaces - when deleted": "C793452", + "Direct path: policy namespaces commands are accessible": "C10294193" }, "Obligations": { "Create a obligation - Good": "C875288", @@ -218,6 +219,7 @@ "Create an obligation trigger - Required Only - IDs - Success": "C875308", "Create an obligation trigger - Required Only - FQNs - Success": "C875309", "Create an obligation trigger - Optional Fields - Success": "C875310", + "Create an obligation trigger - Same tuple different client IDs - Success": "C10294194", "Create an obligation trigger - Bad": "C875311", "Delete an obligation trigger - Good": "C875312", "List obligation triggers - No filters": "C875378", @@ -295,6 +297,9 @@ "Update a SCS - from flag value JSON": "C794014", "Update a SCS - from file": "C797138", "List SCS": "C794015", + "Create a SCS with namespace id": "C10322092", + "Create a SCS with namespace FQN": "C10322093", + "List SCS with namespace filter": "C10322094", "Prune SCS - deletes unmapped SCS alone": "C794016" }, "Subject Mapping": { @@ -303,6 +308,9 @@ "Get subject mapping": "C793465", "Update a subject mapping": "C793466", "List subject mappings": "C793467", + "Create subject mapping with namespace ID": "C10322095", + "Create subject mapping with namespace FQN": "C10322096", + "List subject mappings with namespace": "C10322097", "Delete subject mapping": "C793468" } } diff --git a/e2e/testrail-integration/upload-bats-test-results-to-testrail.sh b/e2e/testrail-integration/upload-bats-test-results-to-testrail.sh index dba2a381..010acee5 100755 --- a/e2e/testrail-integration/upload-bats-test-results-to-testrail.sh +++ b/e2e/testrail-integration/upload-bats-test-results-to-testrail.sh @@ -15,6 +15,13 @@ set -euo pipefail # Dependencies: jq, curl # ================================================================ +# ----------------------------- +# Colors +# ----------------------------- +GREEN='\033[0;32m' +RED='\033[0;31m' +NC='\033[0m' + # ----------------------------- # Load TestRail config # ----------------------------- @@ -73,7 +80,7 @@ lookup_case_id() { while IFS= read -r section; do id=$(jq -r --arg n "$lowercasename" --arg s "$section" ' reduce ( .[$s] | to_entries[] ) as $item (null; - if ($item.key | ascii_downcase) == $n then $item.value else . end + if ($item.key | ascii_downcase | ltrimstr("[auto] ") | ltrimstr("(auto) ")) == $n then $item.value else . end ) ' "$MAPPING_FILE") @@ -86,7 +93,7 @@ lookup_case_id() { # Flat JSON id=$(jq -r --arg n "$lowercasename" ' reduce to_entries[] as $item (null; - if ($item.key | ascii_downcase) == $n then $item.value else . end + if ($item.key | ascii_downcase | ltrimstr("[auto] ") | ltrimstr("(auto) ")) == $n then $item.value else . end ) ' "$MAPPING_FILE") @@ -129,12 +136,12 @@ parse_tap() { if [[ -n "$mapping" ]]; then case_id="${mapping%%|*}" section="${mapping##*|}" - echo "\"$name\" YES $case_id (Section: $section)" - echo "\"$name\" YES $case_id" >> "$REPORT_FILE" + echo -e "\"$name\" ${GREEN}YES${NC} $case_id (Section: $section)" + echo -e "\"$name\" ${GREEN}YES${NC} $case_id" >> "$REPORT_FILE" results+=("{\"case_id\": ${case_id#C}, \"status_id\": $status_id, \"comment\": \"$name\"}") else - echo "\"$name\" NO" - echo "\"$name\" NO" >> "$REPORT_FILE" + echo -e "\"$name\" ${RED}NO${NC}" + echo -e "\"$name\" ${RED}NO${NC}" >> "$REPORT_FILE" fi fi done < "$TAP_FILE" From 756cce6c1bf97734156b4140f1a8cf5b1058e26c Mon Sep 17 00:00:00 2001 From: sievdokymov-virtru Date: Tue, 21 Apr 2026 12:28:40 +0300 Subject: [PATCH 2/7] improvements-update label --- .../upload-bats-test-results-to-testrail.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/e2e/testrail-integration/upload-bats-test-results-to-testrail.sh b/e2e/testrail-integration/upload-bats-test-results-to-testrail.sh index 010acee5..d9e69d54 100755 --- a/e2e/testrail-integration/upload-bats-test-results-to-testrail.sh +++ b/e2e/testrail-integration/upload-bats-test-results-to-testrail.sh @@ -136,12 +136,12 @@ parse_tap() { if [[ -n "$mapping" ]]; then case_id="${mapping%%|*}" section="${mapping##*|}" - echo -e "\"$name\" ${GREEN}YES${NC} $case_id (Section: $section)" - echo -e "\"$name\" ${GREEN}YES${NC} $case_id" >> "$REPORT_FILE" + echo -e "\"$name\" ${GREEN}YES_FOUND${NC} $case_id (Section: $section)" + echo -e "\"$name\" ${GREEN}YES_FOUND${NC} $case_id" >> "$REPORT_FILE" results+=("{\"case_id\": ${case_id#C}, \"status_id\": $status_id, \"comment\": \"$name\"}") else - echo -e "\"$name\" ${RED}NO${NC}" - echo -e "\"$name\" ${RED}NO${NC}" >> "$REPORT_FILE" + echo -e "\"$name\" ${RED}NOT_FOUND${NC}" + echo -e "\"$name\" ${RED}NOT_FOUND${NC}" >> "$REPORT_FILE" fi fi done < "$TAP_FILE" From f0958dd666745be2c06a61e8f9f191e8efe227c3 Mon Sep 17 00:00:00 2001 From: sievdokymov-virtru Date: Tue, 21 Apr 2026 12:29:44 +0300 Subject: [PATCH 3/7] improvements-update label2 --- .../upload-bats-test-results-to-testrail.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/e2e/testrail-integration/upload-bats-test-results-to-testrail.sh b/e2e/testrail-integration/upload-bats-test-results-to-testrail.sh index d9e69d54..9e07ff92 100755 --- a/e2e/testrail-integration/upload-bats-test-results-to-testrail.sh +++ b/e2e/testrail-integration/upload-bats-test-results-to-testrail.sh @@ -136,12 +136,12 @@ parse_tap() { if [[ -n "$mapping" ]]; then case_id="${mapping%%|*}" section="${mapping##*|}" - echo -e "\"$name\" ${GREEN}YES_FOUND${NC} $case_id (Section: $section)" - echo -e "\"$name\" ${GREEN}YES_FOUND${NC} $case_id" >> "$REPORT_FILE" + echo -e "\"$name\" ${GREEN}YES_MAPPING_FOUND${NC} $case_id (Section: $section)" + echo -e "\"$name\" ${GREEN}YES_MAPPING_FOUND${NC} $case_id" >> "$REPORT_FILE" results+=("{\"case_id\": ${case_id#C}, \"status_id\": $status_id, \"comment\": \"$name\"}") else - echo -e "\"$name\" ${RED}NOT_FOUND${NC}" - echo -e "\"$name\" ${RED}NOT_FOUND${NC}" >> "$REPORT_FILE" + echo -e "\"$name\" ${RED}MAPPING_NOT_FOUND${NC}" + echo -e "\"$name\" ${RED}MAPPING_NOT_FOUND${NC}" >> "$REPORT_FILE" fi fi done < "$TAP_FILE" From 7a509ac2dea22244414f81593ab90f7ae12fba6b Mon Sep 17 00:00:00 2001 From: sievdokymov-virtru Date: Tue, 21 Apr 2026 12:34:02 +0300 Subject: [PATCH 4/7] Clean trigger --- .github/workflows/ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b226c5ff..75c8df9f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,7 +5,6 @@ on: push: branches: - main - - ab-2168-otdfctl-manual-trigger schedule: - cron: "45 0 * * *" workflow_dispatch: From 56070a3afcc34f13aedc886c0ef39bb6e873d6e8 Mon Sep 17 00:00:00 2001 From: sievdokymov-virtru Date: Tue, 21 Apr 2026 12:47:16 +0300 Subject: [PATCH 5/7] Avoid breaking layout for report file --- .../upload-bats-test-results-to-testrail.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/testrail-integration/upload-bats-test-results-to-testrail.sh b/e2e/testrail-integration/upload-bats-test-results-to-testrail.sh index 9e07ff92..e075b2a3 100755 --- a/e2e/testrail-integration/upload-bats-test-results-to-testrail.sh +++ b/e2e/testrail-integration/upload-bats-test-results-to-testrail.sh @@ -137,11 +137,11 @@ parse_tap() { case_id="${mapping%%|*}" section="${mapping##*|}" echo -e "\"$name\" ${GREEN}YES_MAPPING_FOUND${NC} $case_id (Section: $section)" - echo -e "\"$name\" ${GREEN}YES_MAPPING_FOUND${NC} $case_id" >> "$REPORT_FILE" + echo "\"$name\" YES_MAPPING_FOUND $case_id" >> "$REPORT_FILE" results+=("{\"case_id\": ${case_id#C}, \"status_id\": $status_id, \"comment\": \"$name\"}") else echo -e "\"$name\" ${RED}MAPPING_NOT_FOUND${NC}" - echo -e "\"$name\" ${RED}MAPPING_NOT_FOUND${NC}" >> "$REPORT_FILE" + echo "\"$name\" MAPPING_NOT_FOUND" >> "$REPORT_FILE" fi fi done < "$TAP_FILE" From 938fd3ab81deb12dde66d673834983cf990089dc Mon Sep 17 00:00:00 2001 From: sievdokymov-virtru Date: Tue, 21 Apr 2026 14:36:00 +0300 Subject: [PATCH 6/7] Check e2e from branch --- .github/workflows/ci.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 75c8df9f..db761342 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,6 +5,7 @@ on: push: branches: - main + - ab-2168-otdfctl-manual-trigger schedule: - cron: "45 0 * * *" workflow_dispatch: @@ -66,7 +67,7 @@ jobs: uses: opentdf/platform/test/start-up-with-containers@main with: platform-ref: "main" - - uses: opentdf/otdfctl/e2e@main + - uses: opentdf/otdfctl/e2e@ab-2168-otdfctl-manual-trigger with: otdfctl-ref: ${{ github.event.pull_request.head.sha || github.sha }} testrail-run-name-for-cli-test: ${{ inputs.testrail-run-name-for-cli-test }} From fd6c9c837382848a5a84a428dec03fd80ffc3c9e Mon Sep 17 00:00:00 2001 From: sievdokymov-virtru Date: Tue, 21 Apr 2026 14:37:17 +0300 Subject: [PATCH 7/7] Clean --- .github/workflows/ci.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index db761342..75c8df9f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,7 +5,6 @@ on: push: branches: - main - - ab-2168-otdfctl-manual-trigger schedule: - cron: "45 0 * * *" workflow_dispatch: @@ -67,7 +66,7 @@ jobs: uses: opentdf/platform/test/start-up-with-containers@main with: platform-ref: "main" - - uses: opentdf/otdfctl/e2e@ab-2168-otdfctl-manual-trigger + - uses: opentdf/otdfctl/e2e@main with: otdfctl-ref: ${{ github.event.pull_request.head.sha || github.sha }} testrail-run-name-for-cli-test: ${{ inputs.testrail-run-name-for-cli-test }}