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

v0.3.9 semver failing on rpm version format 9.99 but pass for format 9.99.9 #532

Closed
milind69 opened this issue Dec 30, 2019 · 8 comments
Closed
Labels

Comments

@milind69
Copy link

Describe the bug
new semver version match if match is format 9.99 it fails but if format is 9.99.9 passes

How To Reproduce

package:
:
installed: true
versions:
and:
- have-len: 1
- contain-element:
semver-constraint: ">=1.10"

kernel:
installed: true
versions:
and:
- have-len: 1
- contain-element:
semver-constraint: ">=3.10.0"

mypkg info
-bash-4.2$ rpm -qa --info
Name :
Version : 1.11
Release : 1.lrh7

Expected Behavior
expect package to pass

Actual Behavior
-bash-4.2$ /usr/local/bin/goss -g package-version.yaml validate -f tap
1..4
ok 1 - Package: : installed: matches expectation: [true]
not ok 2 - : version: Error: Expected a valid semver constraint. Got:
: >=1.10
ok 3 - Package: kernel: installed: matches expectation: [true]
ok 4 - Package: kernel: version: matches expectation: []

Environment:

  • v.0.3.9
  • RHEL7
@milind69 milind69 added the bug label Dec 30, 2019
@milind69
Copy link
Author

correcting the yml file as it dropped pkg name

package:
my-package:
installed: true
versions:
and:
- have-len: 1
- contain-element:
semver-constraint: ">=1.10"

kernel:
installed: true
versions:
and:
- have-len: 1
- contain-element:
semver-constraint: ">=3.10.0"

my-package info
-bash-4.2$ rpm -qa my-package --info
Name : my-package
Version : 1.11
Release : 1.lrh7

where my-package is proprietary package can not share more info

@milind69
Copy link
Author

also looks like -f json is providing oneliner output like -f json_oneline

@aelsabbahy
Copy link
Member

aelsabbahy commented Dec 30, 2019

As per the semver spec:

A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative integers, and MUST NOT contain leading zeroes. X is the major version, Y is the minor version, and Z is the patch version. Each element MUST increase numerically. For instance: 1.9.0 -> 1.10.0 -> 1.11.0.

https://semver.org/#spec-item-2

I think the feature you want is requested in this PR which is still open: #435

See my comment here where I explain why using semver for rpm matching can give incorrect results:
#435 (comment)

Please let me know if the goss manual needs to be re-worded to clarify this further.

RPM version matching/ranges is something I would like to support in the future, but it does not currently exist in goss.

If this feature is important to you add a 👍 to the first comment in #435

Thanks for using goss and providing feedback!

@aelsabbahy
Copy link
Member

Regarding JSON, json_oneliner will be deprecated. See the second bullet on the release notes:

json output now supports -o pretty and behaves like json_oneline. json_oneline will be deprecated in the future

https://github.com/aelsabbahy/goss/releases/tag/v0.3.9

@milind69
Copy link
Author

Thank you for reply , I am new to goss still learning but honesty I am lost when to use semver matcher as the example in the manual is not very clear.. this is good tool but manual lacks example in some advanced area like matching without template and now semver ..
can you give real life example for this

@milind69
Copy link
Author

can you give some real life example than this ?
example:
content:
- 1.0.1
- 1.9.9
matches:
semver-constraint: ">1.0.0 <2.0.0 !=1.5.0"

not sure what "example:" means in the example.

@aelsabbahy
Copy link
Member

aelsabbahy commented Dec 30, 2019

If you have a package that adheres to strict semver format semver-constraint can be used for that. That's about it for now. You'll have to be careful of the gotchas that I linked earlier where rpm and semver differ.

I comment on how semver-constraint is not immediately useful and where it may pair up with future work on the PR, see this comment for more info:
#508 (comment)

@aelsabbahy
Copy link
Member

Closing, since semver-matcher is working as intended and 9.99 isn't semver.

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

No branches or pull requests

2 participants