-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set new logic for invalid seeds (#395)
Allow for some seeds to be invalid unless failOnFailedSeed is set Fail crawl if not valid seeds are provided Co-authored-by: Ilya Kreymer <[email protected]>
- Loading branch information
Showing
3 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import util from "util"; | ||
import {exec as execCallback } from "child_process"; | ||
|
||
const exec = util.promisify(execCallback); | ||
|
||
|
||
test("ensure one invalid seed doesn't end crawl if failOnFailedSeed is not set", async () => { | ||
let passed = true; | ||
try { | ||
await exec("docker run -v $PWD/test-crawls:/crawls webrecorder/browsertrix-crawler crawl --url https://www.iana.org/ --url example.com/invalid-seed --generateWACZ --limit 1 --collection invalidseed"); | ||
} catch (error) { | ||
console.log(error); | ||
passed = false; | ||
} | ||
expect(passed).toBe(true); | ||
}); | ||
|
||
test("ensure one invalid seed fails crawl if failOnFailedSeed is set", async () => { | ||
let passed = true; | ||
try { | ||
await exec("docker run -v $PWD/test-crawls:/crawls webrecorder/browsertrix-crawler crawl --url https://www.iana.org/ --url example.com/invalid-seed --generateWACZ --limit 1 --failOnFailedSeed --collection failseed"); | ||
} | ||
catch (error) { | ||
passed = false; | ||
} | ||
expect(passed).toBe(false); | ||
}); | ||
|
||
test("ensure crawl fails if no valid seeds are passed", async () => { | ||
let passed = true; | ||
try { | ||
await exec("docker run -v $PWD/test-crawls:/crawls webrecorder/browsertrix-crawler crawl --url iana.org/ --url example.com/invalid-seed --generateWACZ --limit 1 --collection allinvalidseeds"); | ||
} | ||
catch (error) { | ||
passed = false; | ||
} | ||
expect(passed).toBe(false); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters