Skip to content

Commit f6afa62

Browse files
authored
Add CV Auto Publish testing to BATS suite (#1930)
1 parent 18d8675 commit f6afa62

3 files changed

Lines changed: 42 additions & 8 deletions

File tree

bats/fb-katello-content.bats

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,16 @@ setup() {
111111
--name="${CONTENT_VIEW}" --repository-id="$repo_id" | grep -q "The repository has been associated"
112112
}
113113

114+
@test "create auto publish composite content view" {
115+
hammer content-view create --organization="${ORGANIZATION}" \
116+
--name="${AUTO_PUBLISH_COMPOSITE_VIEW}" --auto-publish=true --composite
117+
}
118+
119+
@test "add first component to auto publish composite" {
120+
hammer content-view component add --organization="${ORGANIZATION}" \
121+
--latest --component-content-view="${CONTENT_VIEW}" --composite-content-view="${AUTO_PUBLISH_COMPOSITE_VIEW}"
122+
}
123+
114124
@test "publish content view" {
115125
hammer content-view publish --organization="${ORGANIZATION}" \
116126
--name="${CONTENT_VIEW}"
@@ -317,16 +327,21 @@ setup() {
317327
--content-view="${CONTENT_VIEW_2}" --content-view-filter="${FILTER3}" --module-stream-ids=$modulemd_id
318328
}
319329

330+
@test "add second component to auto publish composite" {
331+
hammer content-view component add --organization="${ORGANIZATION}" \
332+
--latest --component-content-view="${CONTENT_VIEW_2}" --composite-content-view="${AUTO_PUBLISH_COMPOSITE_VIEW}"
333+
}
334+
320335
@test "publish first component content view" {
321336
hammer content-view publish --organization="${ORGANIZATION}" \
322337
--name="${CONTENT_VIEW_2}"
323338
}
324339

325340
@test "create composite content view" {
326341
cv_id1=$(hammer --csv --no-headers content-view version list --organization="${ORGANIZATION}" \
327-
| grep "${CONTENT_VIEW_2} 1.0" | cut -d, -f1)
342+
--content-view="${CONTENT_VIEW_2}" --fields=id --per-page=1)
328343
cv_id2=$(hammer --csv --no-headers content-view version list --organization="${ORGANIZATION}" \
329-
| grep "${CONTENT_VIEW} 2.0" | cut -d, -f1)
344+
--content-view="${CONTENT_VIEW}" --fields=id --per-page=1 --page=2)
330345
hammer content-view create --organization="${ORGANIZATION}" \
331346
--name="${CONTENT_VIEW_3}" --composite --component-ids=$cv_id1,$cv_id2
332347
}
@@ -340,23 +355,23 @@ setup() {
340355

341356
@test "incremental update first component cv with composite propagation" {
342357
cvv_id=$(hammer --csv --no-headers content-view version list --organization="${ORGANIZATION}" \
343-
| grep "${CONTENT_VIEW_2}" | cut -d, -f1)
358+
--content-view="${CONTENT_VIEW_2}" --fields=id --per-page=1)
344359
hammer content-view version incremental-update --organization="${ORGANIZATION}" \
345360
--content-view-version-id=$cvv_id --errata-ids=RHEA-2012:0055 --propagate-all-composites=true \
346361
--lifecycle-environments="Library"
347362
}
348363

349364
@test "ensure component cv 1 version 1.1 has proper environments" {
350365
cvv_id=$(hammer --csv --no-headers content-view version list --organization="${ORGANIZATION}" \
351-
| grep "${CONTENT_VIEW_2} 1.1" | cut -d, -f1)
366+
--content-view="${CONTENT_VIEW_2}" --fields=id --per-page=1)
352367
envs_found=$(hammer content-view version info --organization="${ORGANIZATION}" \
353368
--id=$cvv_id | awk '/Lifecycle Environments/{flag=1;next}/Repositories/{flag=0}flag' | grep "Name:")
354369
echo $envs_found | grep -q -E "Name:\s+Library"
355370
}
356371

357372
@test "ensure composite cv version 1.1 has proper environments" {
358373
cvv_id=$(hammer --csv --no-headers content-view version list --organization="${ORGANIZATION}" \
359-
| grep "${CONTENT_VIEW_3} 1.1" | cut -d, -f1)
374+
--content-view="${CONTENT_VIEW_3}" --fields=id --per-page=1)
360375
envs_found=$(hammer content-view version info --organization="${ORGANIZATION}" \
361376
--id=$cvv_id | awk '/Lifecycle Environments/{flag=1;next}/Repositories/{flag=0}flag' | grep "Name:")
362377
echo $envs_found | grep -q -E "Name:\s+Library"
@@ -365,7 +380,7 @@ setup() {
365380

366381
@test "ensure component cv 1 latest version has proper content" {
367382
cvv_id=$(hammer --csv --no-headers content-view version list --organization="${ORGANIZATION}" \
368-
| grep "${CONTENT_VIEW_2} 1.1" | cut -d, -f1)
383+
--content-view="${CONTENT_VIEW_2}" --fields=id --per-page=1)
369384
hammer package list --content-view-version-id=$cvv_id --order='name DESC' --fields='filename' > cvv_content_rpms
370385
diff cvv_content_rpms fixtures/component_1_rpms
371386

@@ -386,7 +401,7 @@ setup() {
386401

387402
@test "ensure component cv 2 latest version has proper content" {
388403
cvv_id=$(hammer --csv --no-headers content-view version list --organization="${ORGANIZATION}" \
389-
| grep "${CONTENT_VIEW} 2.0" | cut -d, -f1)
404+
--content-view="${CONTENT_VIEW}" --fields=id --per-page=1)
390405
hammer package list --content-view-version-id=$cvv_id --order='name DESC' --fields='filename' > cvv_content_rpms_2
391406
diff cvv_content_rpms_2 fixtures/component_2_rpms
392407

@@ -407,7 +422,7 @@ setup() {
407422

408423
@test "ensure composite cv latest version has proper content" {
409424
cvv_id=$(hammer --csv --no-headers content-view version list --organization="${ORGANIZATION}" \
410-
| grep "${CONTENT_VIEW_3} 1.1" | cut -d, -f1)
425+
--content-view="${CONTENT_VIEW_3}" --fields=id --per-page=1)
411426

412427
# Sorting and removing duplicates due to Pulp2/Pulp3 differences (https://projects.theforeman.org/issues/30755)
413428
hammer package list --content-view-version-id=$cvv_id --order='name DESC' --fields='filename' \
@@ -429,6 +444,13 @@ setup() {
429444
--order='tag' | grep 'sha256:13280b5914050853a87d662c3229d42b61544e36dd4515f06e188835f3407468'
430445
}
431446

447+
@test "ensure auto publish composite was auto published" {
448+
hammer --csv --no-headers content-view version list --organization="${ORGANIZATION}" \
449+
--content-view="${AUTO_PUBLISH_COMPOSITE_VIEW}" --fields=description > auto_publish_composite_versions
450+
451+
diff auto_publish_composite_versions fixtures/auto_publish_composite_versions
452+
}
453+
432454
@test "fetch rpm from yum repository on old path" {
433455
tCheckPulpYumContent "${HOSTNAME}" "pulp/repos" "Library"
434456
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Auto Publish - Triggered by 'Component 1 1.1'
2+
"Errata:
3+
RHEA-2012:0055
4+
5+
Packages:
6+
penguin-0.9.1-1.noarch
7+
shark-0.1-1.noarch
8+
walrus-5.21-1.noarch"
9+
Auto Publish - Triggered by 'Component 1 1.0'
10+
Auto Publish - Triggered by 'Test CV 2.0'
11+
Auto Publish - Triggered by 'Test CV 1.0'

bats/fixtures/content.bash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ LIFECYCLE_ENVIRONMENT="Test"
1717
CONTENT_VIEW="Test CV"
1818
CONTENT_VIEW_2="Component 1"
1919
CONTENT_VIEW_3="Composite"
20+
AUTO_PUBLISH_COMPOSITE_VIEW="AutoPublishComposite"
2021
LIBRARY="Export-Library"
2122
IMPORT_LIBRARY="Import-Library"
2223
ACTIVATION_KEY="Test AK"

0 commit comments

Comments
 (0)