mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-16 21:33:41 +00:00
fix(script): keep the task name in the script snapshot; wait for the full env output in tests (#1568)
This commit is contained in:
1 parent
ebfd113360
commit
5bd57608d2
4 files changed
+78
-16
No files matched your search
@@ -87,13 +87,8 @@ func TestScript_EnvironmentVariables(t *testing.T) {
|
||||
t.Setenv("GOPEED_TEST_OUTPUT_FILE", outputFile)
|
||||
downloader.triggerScripts(ScriptEventDownloadDone, task, nil)
|
||||
|
||||
waitForFile(t, outputFile, 5*time.Second)
|
||||
content, err := os.ReadFile(outputFile)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to read output file: %v", err)
|
||||
}
|
||||
|
||||
output := string(content)
|
||||
// GOPEED_TASK_PATH is the last line the script writes.
|
||||
output := waitForFileContains(t, outputFile, "GOPEED_TASK_PATH=", 5*time.Second)
|
||||
if !strings.Contains(output, "GOPEED_EVENT=DOWNLOAD_DONE") {
|
||||
t.Errorf("Expected GOPEED_EVENT in output, got: %s", output)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user