-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fetch tests #136
Closed
Closed
Add fetch tests #136
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,102 @@ | ||
use "files" | ||
use "ponytest" | ||
use "../bundle" | ||
use "../util" | ||
use "../vcs" | ||
|
||
actor _TestCmdFetch is TestList | ||
new make() => | ||
None | ||
|
||
fun tag tests(test: PonyTest) => | ||
test(_TestFetchEmptyDeps) | ||
test(_TestFetchEmptyFile) | ||
test(_TestFetchMutuallyRecursive) | ||
test(_TestFetchSelfReferential) | ||
|
||
class iso _TestFetchEmptyDeps is UnitTest | ||
""" | ||
Verify that when using corral.json with empty deps, that there | ||
are never any sync, tag query, or checkout operations executed. | ||
""" | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extra newline here and elsewhere in this file. |
||
fun name(): String => | ||
"cmd/fetch/" + __loc.type_name() | ||
|
||
fun apply(h: TestHelper) ? => | ||
_OpsRecorderFetchTestRunner( | ||
h, | ||
"empty-deps", | ||
_OpsRecorder(h, 0, 0, 0))? | ||
|
||
class iso _TestFetchEmptyFile is UnitTest | ||
""" | ||
Verify that when using corral.json with an empty deps file, that there | ||
are never any sync, tag query, or checkout operations executed. | ||
""" | ||
|
||
fun name(): String => | ||
"cmd/fetch/" + __loc.type_name() | ||
|
||
fun apply(h: TestHelper) ? => | ||
_OpsRecorderFetchTestRunner( | ||
h, | ||
"empty-file", | ||
_OpsRecorder(h, 0, 0, 0))? | ||
|
||
class iso _TestFetchSelfReferential is UnitTest | ||
""" | ||
Verify that a self reference in a corral.json results in only 1 operation | ||
""" | ||
fun name(): String => | ||
"cmd/fetch/" + __loc.type_name() | ||
|
||
fun apply(h: TestHelper) ? => | ||
_OpsRecorderFetchTestRunner( | ||
h, | ||
"self-referential", | ||
_OpsRecorder(h, 1, 0, 1))? | ||
|
||
class iso _TestFetchMutuallyRecursive is UnitTest | ||
""" | ||
Verify that when using mutually recursive corral.json files that we | ||
execute the correct number of operations | ||
""" | ||
|
||
fun name(): String => | ||
"cmd/fetch/" + __loc.type_name() | ||
|
||
fun apply(h: TestHelper) ? => | ||
_OpsRecorderFetchTestRunner( | ||
h, | ||
"mutually-recursive/foo", | ||
_OpsRecorder(h, 2, 0, 2))? | ||
|
||
primitive _OpsRecorderFetchTestRunner | ||
fun apply(h: TestHelper, dep_path: String val, recorder: _OpsRecorder) ? => | ||
""" | ||
Runs an _OpsRecorder test. | ||
""" | ||
let auth = h.env.root as AmbientAuth | ||
let log = Log(LvlNone, h.env.err, SimpleLogFormatter) | ||
let fp: FilePath = _TestData.file_path_from(h, dep_path)? | ||
let repo_cache = _TestRepoCache(auth, "_test_cmd_fetch_repo_cache")? | ||
let ctx = Context(h.env, log, log, false, repo_cache) | ||
let project = Project(auth, log, fp) | ||
let bundle = Bundle.load(fp, log)? | ||
let vcs_builder: VCSBuilder = _TestCmdFetchVCSBuilder(recorder) | ||
|
||
let fetcher = _Fetcher(ctx, project, consume bundle, vcs_builder, | ||
recorder) | ||
|
||
// when fetcher is finished, it will send a `cmd_completed` message to | ||
// _OpsRecorder which will trigger pass/fail | ||
|
||
class val _TestCmdFetchVCSBuilder is VCSBuilder | ||
let _recorder: _OpsRecorder | ||
|
||
new val create(recorder: _OpsRecorder) => | ||
_recorder = recorder | ||
|
||
fun val apply(kind: String): VCS => | ||
_RecordedVCS(_recorder) |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should add a test for transitive dependencies. That would mean renaming the regression-120 stuff to be a more generic "transitive dependencies" test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do