@@ -3390,26 +3390,46 @@ def toy(extra_args=None):
33903390 return test_report_txt
33913391
33923392 # define environment variables that should (not) show up in the test report
3393- test_var_secret = 'THIS_IS_JUST_A_SECRET_ENV_VAR_FOR_EASYBUILD'
3394- os .environ [test_var_secret ] = 'thisshouldremainsecretonrequest'
3395- test_var_secret_regex = re .compile (test_var_secret )
3393+ # The name contains an auto-excluded pattern `SECRET`
3394+ test_var_secret_always = 'THIS_IS_JUST_A_SECRET_ENV_VAR_FOR_EASYBUILD'
3395+ os .environ [test_var_secret_always ] = 'thisshouldremainsecretonrequest'
3396+ test_var_secret_always_regex = re .compile (test_var_secret_always )
3397+ # The name contains an autoexcluded value as a recognized GH token
3398+ test_var_secret_always2 = 'THIS_IS_JUST_A_TOTALLY_PUBLIC_ENV_VAR_FOR_EASYBUILD'
3399+ os .environ [test_var_secret_always2 ] = 'ghp_123456789_ABCDEFGHIJKlmnopqrstuvwxyz'
3400+ test_var_secret_always_regex2 = re .compile (test_var_secret_always2 )
3401+ # This should be in general present and excluded on demand
3402+ test_var_secret_ondemand = 'THIS_IS_A_CUSTOM_ENV_VAR_FOR_EASYBUILD'
3403+ os .environ [test_var_secret_ondemand ] = 'thisshouldbehiddenondemand'
3404+ test_var_secret_ondemand_regex = re .compile (test_var_secret_ondemand )
33963405 test_var_public = 'THIS_IS_JUST_A_PUBLIC_ENV_VAR_FOR_EASYBUILD'
33973406 os .environ [test_var_public ] = 'thisshouldalwaysbeincluded'
33983407 test_var_public_regex = re .compile (test_var_public )
33993408
34003409 # default: no filtering
34013410 test_report_txt = toy ()
3402- self .assertTrue (test_var_secret_regex .search (test_report_txt ))
3411+ self .assertTrue (test_var_secret_ondemand_regex .search (test_report_txt ))
34033412 self .assertTrue (test_var_public_regex .search (test_report_txt ))
3413+ for rgx in [
3414+ test_var_secret_always_regex ,
3415+ test_var_secret_always_regex2 ,
3416+ ]:
3417+ res = rgx .search (test_report_txt )
3418+ self .assertFalse (res , "No match for %s in %s" % (rgx .pattern , test_report_txt ))
34043419
34053420 # filter out env vars that match specified regex pattern
3406- filter_arg = "--test-report-env-filter=.*_SECRET_ENV_VAR_FOR_EASYBUILD "
3421+ filter_arg = "--test-report-env-filter=.*_IS_A_CUSTOM_ENV_VAR_FOR_EASYBUILD "
34073422 test_report_txt = toy (extra_args = [filter_arg ])
3408- res = test_var_secret_regex .search (test_report_txt )
3409- self .assertFalse (res , "No match for %s in %s" % (test_var_secret_regex .pattern , test_report_txt ))
3423+ for rgx in [
3424+ test_var_secret_ondemand_regex ,
3425+ test_var_secret_always_regex ,
3426+ test_var_secret_always_regex2 ,
3427+ ]:
3428+ res = rgx .search (test_report_txt )
3429+ self .assertFalse (res , "No match for %s in %s" % (rgx .pattern , test_report_txt ))
34103430 self .assertTrue (test_var_public_regex .search (test_report_txt ))
34113431 # make sure that used filter is reported correctly in test report
3412- filter_arg_regex = re .compile (r"--test-report-env-filter='.\*_SECRET_ENV_VAR_FOR_EASYBUILD '" )
3432+ filter_arg_regex = re .compile (r"--test-report-env-filter='.\*_IS_A_CUSTOM_ENV_VAR_FOR_EASYBUILD '" )
34133433 tup = (filter_arg_regex .pattern , test_report_txt )
34143434 self .assertTrue (filter_arg_regex .search (test_report_txt ), "%s in %s" % tup )
34153435
0 commit comments