Skip to content

Commit

Permalink
Add CI test for uuid5 function
Browse files Browse the repository at this point in the history
Test uuid5 generates same value with given same input and vice-versa

Signed-off-by: venkata pyla <[email protected]>
  • Loading branch information
venkata-pyla authored and sjoerdsimons committed Jan 13, 2024
1 parent 628230b commit f1a2441
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ jobs:
test:
- { name: "recipes", case: "recipes" }
- { name: "templating", case: "templating", variables: " -t escaped:\\$ba\\'d\\$gers\\ snakes" }
- { name: "uuid5", case: "uuid5" }
- { name: "debian (amd64)", case: "debian", variables: "-t architecture:amd64" }
- { name: "debian (arm64)", case: "debian", variables: "-t architecture:arm64" }
- { name: "debian (armhf)", case: "debian", variables: "-t architecture:armhf" }
Expand Down
1 change: 1 addition & 0 deletions tests/uuid5/expected.uuid5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3deb2a0e-692c-5a37-93c0-1123948bf5ae
23 changes: 23 additions & 0 deletions tests/uuid5/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# expected.uuid5 contains value generated with $namespace and $text1
{{ $namespace := or .namespace "6c9d1418-8fa9-11ee-b4ca-325096b39f47" }}
{{ $text1 := or .text1 "ver1.0" }}
{{ $text2 := or .text2 "ver2.0" }}

architecture: amd64

actions:
- action: run
description: test uuid5 generate same value when input is same
chroot: false
command: echo {{ uuid5 $namespace $text1 }} > ${RECIPEDIR}/actual1.uuid5
- action: run
chroot: false
command: diff -u ${RECIPEDIR}/actual1.uuid5 ${RECIPEDIR}/expected.uuid5

- action: run
description: test uuid5 generate different value when input is different
chroot: false
command: echo {{ uuid5 $namespace $text2 }} > ${RECIPEDIR}/actual2.uuid5
- action: run
chroot: false
command: diff -s ${RECIPEDIR}/actual2.uuid5 ${RECIPEDIR}/expected.uuid5 && exit 1 || exit 0

0 comments on commit f1a2441

Please sign in to comment.