Whamcloud - gitweb
LU-16878 tests: use RUNAS_UID / RUNAS_GID for NRS TBF 38/51238/5
authorJames Simmons <jsimmons@infradead.org>
Thu, 20 Jul 2023 19:57:36 +0000 (15:57 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 1 Aug 2023 06:15:09 +0000 (06:15 +0000)
Some of the sanityn NRS TBF test hardcode the use of uid 500 and gid
500. They are not guaranteed to exist so use RUNAS_UID and RUNAS_GID
instead.

Test-Parameters: trivial testlist=sanityn env=ONLY=77
Change-Id: Ie987c70e94918c5cddadb632a4a3a3caac12c96f
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51238
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Deiter <alex.deiter@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanityn.sh

index 135b241..a283b15 100755 (executable)
@@ -4454,8 +4454,8 @@ test_77ja(){
                skip "Need OST version at least 2.11.50"
        fi
 
-       test_id "u" "500" "5" "-u 500"
-       test_id "g" "500" "5" "-u 500 -g 500"
+       test_id "u" "$RUNAS_ID" "5" "-u $RUNAS_ID"
+       test_id "g" "$RUNAS_GID" "5" "-u $RUNAS_ID -g $RUNAS_GID"
 }
 run_test 77ja "check TBF-UID/GID NRS policy"
 
@@ -4463,8 +4463,8 @@ test_77jb() { # LU-16077
        (( "$OST1_VERSION" >= $(version_code 2.15.51) )) ||
                skip "Need OST version at least 2.15.51"
 
-       test_id "u" "500" "5" "-u 500" "-u 0 -g 500"
-       test_id "g" "500" "5" "-u 500 -g 500" "-u 500 -g 0"
+       test_id "u" "$RUNAS_ID" "5" "-u $RUNAS_ID" "-u 0 -g $RUNAS_GID"
+       test_id "g" "$RUNAS_GID" "5" "-u $RUNAS_ID -g $RUNAS_GID" "-u $RUNAS_ID -g 0"
 }
 run_test 77jb "check TBF-UID/GID NRS policy on files that don't belong to us"
 
@@ -4535,26 +4535,26 @@ test_77k() {
        do_nodes $(comma_list $(osts_nodes)) \
                lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_a" \
                        ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_b" \
-                       ost.OSS.ost_io.nrs_tbf_rule="start\ ext_ug\ uid={500}\&gid={1000}\ rate=5"
-       nrs_write_read "runas -u 500 -g 1000"
-       tbf_verify 5 5 "runas -u 500 -g 1000"
+                       ost.OSS.ost_io.nrs_tbf_rule="start\ ext_ug\ uid={$RUNAS_ID}\&gid={$RUNAS_GID}\ rate=5"
+       nrs_write_read "runas -u $RUNAS_ID -g $RUNAS_GID"
+       tbf_verify 5 5 "runas -u $RUNAS_ID -g $RUNAS_GID"
 
        do_nodes $(comma_list $(osts_nodes)) \
                lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_ug" \
-                       ost.OSS.ost_io.nrs_tbf_rule="start\ ext_uw\ uid={500}\&opcode={ost_write}\ rate=20" \
-                       ost.OSS.ost_io.nrs_tbf_rule="start\ ext_ur\ uid={500}\&opcode={ost_read}\ rate=10"
+                       ost.OSS.ost_io.nrs_tbf_rule="start\ ext_uw\ uid={$RUNAS_ID}\&opcode={ost_write}\ rate=20" \
+                       ost.OSS.ost_io.nrs_tbf_rule="start\ ext_ur\ uid={$RUNAS_ID}\&opcode={ost_read}\ rate=10"
 
-       nrs_write_read "runas -u 500"
-       tbf_verify 20 10 "runas -u 500"
+       nrs_write_read "runas -u $RUNAS_ID"
+       tbf_verify 20 10 "runas -u $RUNAS_ID"
 
        do_nodes $(comma_list $(osts_nodes)) \
                lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_uw" \
                        ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_ur" \
-                       ost.OSS.ost_io.nrs_tbf_rule="start\ ext_a\ uid={500},opcode={ost_write}\ rate=20" \
-                       ost.OSS.ost_io.nrs_tbf_rule="start\ ext_b\ uid={500},opcode={ost_read}\ rate=10"
-       nrs_write_read "runas -u 500"
-       tbf_verify 10 10 "runas -u 500"
-       tbf_verify 20 10 "runas -u 500"
+                       ost.OSS.ost_io.nrs_tbf_rule="start\ ext_a\ uid={$RUNAS_ID},opcode={ost_write}\ rate=20" \
+                       ost.OSS.ost_io.nrs_tbf_rule="start\ ext_b\ uid={$RUNAS_ID},opcode={ost_read}\ rate=10"
+       nrs_write_read "runas -u $RUNAS_ID"
+       tbf_verify 10 10 "runas -u $RUNAS_ID"
+       tbf_verify 20 10 "runas -u $RUNAS_ID"
        cleanup_77k "ext_a ext_b" "fifo"
 }
 run_test 77k "check TBF policy with NID/JobID/OPCode expression"