Skip to content

Commit db74e5c

Browse files
committed
Add kuttl-remove-test.sh
1 parent e9af3cd commit db74e5c

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

kuttl-insert-test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ do
2323
new_number=$(expr "$number" + 1)
2424
new_number_padded=$(printf "%02d" "$new_number")
2525
new_file=$(echo "$file" | sed "s/^$number-/$new_number_padded-/")
26+
echo "moving: $file to: $new_file"
2627
mv "$file" "$new_file"
2728
fi
2829
done

kuttl-remove-test.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
#
3+
# This script descreases the numbers of kuttl test cases
4+
# (id's of test cases including and after requested will be increased)
5+
6+
# Check if argument is provided
7+
if [ -z "$1" ]
8+
then
9+
echo "Please provide a number of test case which number should be decreased."
10+
exit 1
11+
fi
12+
13+
# Loop through the files and rename them
14+
for file in $(ls -v [0-9][0-9]-*)
15+
do
16+
# Get the number from the beginning of the filename
17+
number=$(echo "$file" | cut -d '-' -f 1)
18+
19+
# Check if the number is greater than or equal to the argument
20+
if [ "$number" -ge "$1" ]
21+
then
22+
# Decrease the number by 1 and rename the file
23+
new_number=$(expr "$number" - 1)
24+
new_number_padded=$(printf "%02d" "$new_number")
25+
new_file=$(echo "$file" | sed "s/^$number-/$new_number_padded-/")
26+
echo "moving: $file to: $new_file"
27+
mv "$file" "$new_file"
28+
fi
29+
done

0 commit comments

Comments
 (0)