-
Notifications
You must be signed in to change notification settings - Fork 237
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
feat(dal,sdf): Auto-enqueue update functions for impacted components #5511
Merged
Merged
Changes from all commits
Commits
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 |
---|---|---|
|
@@ -231,11 +231,8 @@ async fn auto_queue_creation(ctx: &mut DalContext) { | |
assert!(action_ids.is_empty()); | ||
} | ||
|
||
// TODO This test is a stub that should be fixed after actions v2 is done | ||
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. TODONE |
||
// Right now, the workspace for tests does not have the actions flag set so this won't yield any results | ||
// The tests cases are valid | ||
#[test] | ||
async fn auto_queue_update_and_destroy(ctx: &mut DalContext) { | ||
async fn auto_queue_update(ctx: &mut DalContext) { | ||
// ====================================================== | ||
// Creating a component should enqueue a create action | ||
// ====================================================== | ||
|
@@ -252,6 +249,11 @@ async fn auto_queue_update_and_destroy(ctx: &mut DalContext) { | |
.await | ||
.expect("apply changeset to base"); | ||
|
||
// wait for actions to run | ||
ChangeSetTestHelpers::wait_for_actions_to_run(ctx) | ||
.await | ||
.expect("deadline for actions to run exceeded"); | ||
|
||
ChangeSetTestHelpers::fork_from_head_change_set(ctx) | ||
.await | ||
.expect("fork from head"); | ||
|
@@ -271,6 +273,9 @@ async fn auto_queue_update_and_destroy(ctx: &mut DalContext) { | |
AttributeValue::update(ctx, av_id, Some(serde_json::json!("whomever"))) | ||
.await | ||
.expect("override domain/name attribute value"); | ||
Component::enqueue_relevant_update_actions(ctx, av_id) | ||
.await | ||
.expect("could enqueue update func"); | ||
|
||
let action_ids = Action::list_topologically(ctx) | ||
.await | ||
|
@@ -296,49 +301,7 @@ async fn auto_queue_update_and_destroy(ctx: &mut DalContext) { | |
}; | ||
} | ||
} | ||
|
||
// TODO: fix this, update actions have been disabled for now so they wont be automatically enqueued | ||
// As they were being enqueued in the wrong place in AttributeValue, causing actions to be enqueued and immediately run by DVU's running on headg | ||
assert_eq!(update_action_count, 0); | ||
|
||
// ====================================================== | ||
// Deleting a component with resource should queue the Destroy action | ||
// ====================================================== | ||
component.delete(ctx).await.expect("delete component"); | ||
ChangeSetTestHelpers::commit_and_update_snapshot_to_visibility(ctx) | ||
.await | ||
.expect("could not commit and update snapshot to visibility"); | ||
|
||
// TODO Fix the following section | ||
// Since the creation action never actually runs on the test (or at least we can't wait for it) | ||
// The resource never gets created. A Destroy action only gets queued | ||
// (implicitly by component.delete above) if the component has a resource, | ||
// So the check below is failing | ||
|
||
// let action_ids = Action::list_topologically(ctx) | ||
// .await | ||
// .expect("find action ids"); | ||
// | ||
// let mut deletion_action_count = 0; | ||
// for action_id in action_ids { | ||
// let action = dbg!(Action::get_by_id(ctx, action_id) | ||
// .await | ||
// .expect("find action by id")); | ||
// if action.state() == ActionState::Queued { | ||
// let prototype_id = Action::prototype_id(ctx, action_id) | ||
// .await | ||
// .expect("get prototype id from action"); | ||
// let prototype = ActionPrototype::get_by_id(ctx, prototype_id) | ||
// .await | ||
// .expect("get action prototype by id"); | ||
// | ||
// if prototype.kind == ActionKind::Destroy { | ||
// deletion_action_count += 1; | ||
// } | ||
// } | ||
// } | ||
|
||
// assert_eq!(deletion_action_count, 1); | ||
assert_eq!(update_action_count, 1); | ||
} | ||
|
||
#[test] | ||
|
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
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
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.
this can likely be refined to look for updates only to domain, or something to that effect, but as it's behind a flag, we can iterate here to work out the permutations
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.
actually I'm changing this up now. stay tuned.