diff --git a/tests/gold_tests/pluginTest/regex_revalidate/regex_revalidate_state.test.py b/tests/gold_tests/pluginTest/regex_revalidate/regex_revalidate_state.test.py index d733cddda48..04433cc5f71 100644 --- a/tests/gold_tests/pluginTest/regex_revalidate/regex_revalidate_state.test.py +++ b/tests/gold_tests/pluginTest/regex_revalidate/regex_revalidate_state.test.py @@ -61,7 +61,7 @@ server.addResponse("sessionlog.json", request_header_0, response_header_0) reval_conf_path = os.path.join(ts.Variables.CONFIGDIR, 'reval.conf') -reval_state_path = os.path.join(ts.Variables.RUNTIMEDIR, 'reval.state') +reval_state_path = os.path.join(Test.Variables.RUNTIMEDIR, 'reval.state') # Configure ATS server ts.Disk.plugin_config.AddLine( @@ -109,6 +109,8 @@ path0_rule, path1_rule, ]) +ts.chownForATSProcess(reval_state_path) + ts.Disk.remap_config.AddLine( f"map http://ats/ http://127.0.0.1:{server.Variables.Port}" ) @@ -120,11 +122,21 @@ 'proxy.config.http.wait_for_cache': 1, }) + +# This TestRun creates the state file so it exists when the ts process's Setup +# logic is run so that it can be chowned at that point. +tr = Test.AddTestRun("Populate the regex_revalidate state file") +tr.Processes.Default.Command = f'touch {reval_state_path}' + # Start ATS and evaluate the new state file tr = Test.AddTestRun("Initial load, state merged") ps = tr.Processes.Default ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) -ps.StartBefore(Test.Processes.ts) + +# Note the ready condition: wait for ATS to modify the contents +# of the file from dummy to path1. +ps.StartBefore(Test.Processes.ts, ready=When.FileContains(reval_state_path, "path0")) + ps.Command = 'cat ' + reval_state_path ps.ReturnCode = 0 ps.Streams.stdout.Content = Testers.GoldFile(gold_path_good)