Skip to content
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

boundimage: Add tmt tests for bound images #729

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

ckyrouac
Copy link
Contributor

These tests validate the basic use case of switching and upgrading an image with bound images that need to be pulled.

Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

Looks sane to me! Just one nonblocking nit

initial_setup

# build a bootc image that includes bound images
let images = echo [
Copy link
Collaborator

Choose a reason for hiding this comment

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

The echo here shouldn't be necessary, in nushell I think it's basically a no-op. It notably doesn't convert the argument to a string.

Copy link
Collaborator

Choose a reason for hiding this comment

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

(Here and a variety of other places)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah - I'll clean these up before merging

@cgwalters
Copy link
Collaborator

At the end of doing this, what did you think? I personally ended up somewhat ambivalent about the nushell usage for tests...my overall feeling was I could have written 70% of it faster in bash, except there's that 20% where you want to parse some JSON or operate on arrays and I need to go look up syntax and about 10% of horrible bash pitfalls.

@ckyrouac
Copy link
Contributor Author

I like it, I think these will be way easier to maintain in the long run. It was a little frustrating digging through the nu shell docs at times and chat gpt (and other llms) wasn't very helpful. Still, after the initial (relatively low) learning curve I think this a lot nicer than bash. I eventually got familiar enough with testing stuff directly in a nu shell prompt which seems more ergonomic than zsh or bash. I'll probably switch over to it as my main shell soon.

@ckyrouac ckyrouac marked this pull request as draft July 25, 2024 20:48
@ckyrouac
Copy link
Contributor Author

marking this as a draft because I started seeing some odd behavior related to handling reboots. I ran out of time today to figure out the cause and I'll be AFK for awhile. AFAICT the problem is that on each reboot all of the nu shell tmt tests run. So, trying to read the reboot count in each test gets tricky. I think for now we could just dump all the tests in a single file, but we probably want to isolate each test to a separate VM and run them in parallel or something.

@cgwalters
Copy link
Collaborator

Oh wow...yes, oops.

but we probably want to isolate each test to a separate VM and run them in parallel or something.

Yes, this is quite doable, I'll take a look at figuring out the relevant tmt incantations.

@cgwalters
Copy link
Collaborator

Let's track this issue here #735

@cgwalters
Copy link
Collaborator

cgwalters commented Jul 26, 2024

Want to try rebasing on top of #736 ? It will require something like:

cp plans/test-20-local-upgrade.fmf plans/test-21-bound-images.fmf and then replacing the test executed inside that fmf file.

(Which will become our new SOP for destructive tests unfortunately)

These tests validate the basic use case of switching and upgrading
an image with bound images that need to be pulled.

Signed-off-by: Chris Kyrouac <ckyrouac@redhat.com>
Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

  • rebased on main
  • Added a fmf wrapper per new test SOP
  • dropped the unnecessary echo (btw: doing so made the LSP plugin correctly do type inference! While nushell is somewhat obscure it's at least got a functioning language server and also functioning type inference; very unlikely to happen for bash...)

Comment on lines 146 to 148
null | "0" => first_boot,
null | "1" => second_boot,
null | "2" => third_boot,
Copy link
Collaborator

Choose a reason for hiding this comment

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

The last two null here are unreachable (only the first can match), a bit surprising nu doesn't error on this. I've updated the code to drop them.

@cgwalters cgwalters marked this pull request as ready for review July 29, 2024 21:23
@cgwalters
Copy link
Collaborator

$ tmt run plans -n test-21-logically-bound
/var/tmp/tmt/run-003

/plans/test-21-logically-bound
...
total: 1 test passed

🎉

@cgwalters cgwalters merged commit e25e928 into containers:main Jul 29, 2024
25 of 28 checks passed
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.

2 participants