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

Use json output for snapper #19281

Merged
merged 1 commit into from May 15, 2024
Merged

Conversation

mloviska
Copy link
Contributor

@mloviska mloviska commented May 10, 2024

Newer version of snapper support json output. It is more convenient for parsing the data in snapper tests.

Verification runs

Copy link

Great PR! Please pay attention to the following items before merging:

Files matching lib/**.pm:

  • Consider adding or extending unit tests in t/

This is an automatically generated QA checklist based on modified files.

@mloviska mloviska requested a review from Vogtinator May 10, 2024 10:57
Copy link
Contributor

@ricardobranco777 ricardobranco777 left a comment

Choose a reason for hiding this comment

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

Minor comment about use of global variable. Otherwise LGTM. This will need some VR's ofc.

lib/btrfs_test.pm Show resolved Hide resolved
lib/btrfs_test.pm Outdated Show resolved Hide resolved
lib/main_common.pm Outdated Show resolved Hide resolved
@mloviska
Copy link
Contributor Author

VRs updated

# but other data which was written to serial device. We have to ensure
# that we got what we expect. See poo#25716
sub _get_last_snap_number_old {
# get snapshot id column, parse output in perl to avoid SIGPIPE
Copy link
Member

Choose a reason for hiding this comment

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

This whole function can be done in a single awk call:

snapper list --disable-used-space | awk -F '|' 'NR == 1 { for(i=1; i <= NF; ++i) if (match($i, /^ *# *$/)) colno = i; } END { print strtonum($colno); }'

Edit: There's a bug, fixing... Done

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 do not doubt that, but I am not sure whether we want to invest much time to code that is meant to be deleted. Maybe we can do that in another PR and merge this one for now

Copy link
Member

Choose a reason for hiding this comment

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

I do not doubt that, but I am not sure whether we want to invest much time to code that is meant to be deleted. Maybe we can do that in another PR and merge this one for now

Makes the legacy code shorter, but I do get the point of not touching that code at all. There have to be VRs anyway, so might be worth it 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is the thing, the VRs are already done for now. If we need to add another set or another round then yes, I can replace that code

Copy link
Member

Choose a reason for hiding this comment

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

That is the thing, the VRs are already done for now.

The one for TW is red, at least snapper_used_space needs to be adjusted as well

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 think the used space column was missing in the basic list output. Lemme check it once more.

Copy link
Contributor

@grisu48 grisu48 left a comment

Choose a reason for hiding this comment

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

LGTM!

@mloviska
Copy link
Contributor Author

VR for the snapper_used_space http://kepler.suse.cz/tests/23336#step/snapper_used_space/13

lib/btrfs_test.pm Outdated Show resolved Hide resolved
@mloviska mloviska force-pushed the snapper_out_rework branch 2 times, most recently from 58460db to 4ea6592 Compare May 13, 2024 17:19
Newer version of snapper support json output. It is more convenient for
parsing the data in snapper tests.

- ticket: https://progress.opensuse.org/issues/160026
@mloviska mloviska merged commit 440675d into os-autoinst:master May 15, 2024
10 checks passed
@michaelgrifalconi
Copy link
Contributor

michaelgrifalconi commented May 16, 2024

@michaelgrifalconi
Copy link
Contributor

Linking fix PR in case someone ends up here looking at old tests :) #19318

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants