Skip to content

Add acceptance test for bundle run #2695

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

Merged
merged 84 commits into from
May 9, 2025
Merged

Add acceptance test for bundle run #2695

merged 84 commits into from
May 9, 2025

Conversation

shreyas-goenka
Copy link
Contributor

@shreyas-goenka shreyas-goenka commented Apr 9, 2025

Followup to #2413, adding more coverage to ensure we have proper disambiguation between when bundle run is used to run a resource vs execute a script.

Copy link
Contributor

@denik denik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also add a map storing runId -> jobs.Run so that runs/get can return an error when wrong run is requested (this is the level of support we have for all other resources).

Base automatically changed from bundle-exec to main April 24, 2025 21:36
@shreyas-goenka
Copy link
Contributor Author

@denik Made the fake server stateful, can you take another look?

@@ -188,7 +188,7 @@ func (r *jobRunner) Run(ctx context.Context, opts *Options) (output.RunOutput, e

waiter, err := w.Jobs.RunNow(ctx, *req)
if err != nil {
return nil, fmt.Errorf("cannot start job: %w", err)
return nil, errors.New("cannot start job")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the motivation for this? Why have less details?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just splitting it into a separate PR: #2843 since it's not directly related. This PR does not remove it.

@@ -104,9 +104,6 @@ task or a Python wheel task, the second example applies.
You can also use the bundle run command to execute scripts / commands in the same
authentication context as the bundle.

Note: The current working directory of the provided command will be set to the root
of the bundle.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not true anymore? why this message is deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this diff, are you reviewing a specific commit?

}

// Mark the run as terminated.
run.State.LifeCycleState = jobs.RunLifeCycleStateTerminated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be very specific to a particular test, might not be reusable. Perhaps instead you can have explicit endpoint to update this field?

Copy link
Contributor Author

@shreyas-goenka shreyas-goenka May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bundle run command blocks for the run to terminate. The run state is an internal detail and all runs automatically transition to terminated, so it's a fair way to model this in a fake workspace.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, we can extend this later.

@@ -0,0 +1,16 @@
title "no run key specified"
errcode trace $CLI bundle run
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: personally prefer smaller tests, easier to review/debug and faster to run. e.g. you could split error-raising commands from the rest.

if you have one command then you also don't need to specify title (it's test name), errcode and trace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, but in this case it's only 5 commands so still small. The flip side is you end up with a bunch of really granular files / tests which does not seem optimal.

@@ -19,6 +19,7 @@ acceptance/selftest/record_cloud/volume-io/hello.txt

# "bundle run" has trailing whitespace:
acceptance/bundle/integration_whl/*/output.txt
acceptance/bundle/run/basic/output.txt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it here? The last command is "echo" which includes a newline.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The run command itself has a trailing space in it's output, not the echo command. Specifically:

[DATE] HH:MM:SS "run-name" TERMINATED

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this easily fixable? I would prefer to keep this ignore list to the absolute minimum.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to fix in #2864

@denik denik self-requested a review May 9, 2025 14:07
Copy link
Contributor

@denik denik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@shreyas-goenka shreyas-goenka added this pull request to the merge queue May 9, 2025
Merged via the queue into main with commit 6586291 May 9, 2025
10 checks passed
@shreyas-goenka shreyas-goenka deleted the test-bundle-run branch May 9, 2025 14:40
github-merge-queue bot pushed a commit that referenced this pull request May 13, 2025
anton-107 pushed a commit that referenced this pull request May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants