goss-org / goss

Quick and Easy server testing/validation
https://goss.rocks
Apache License 2.0
5.62k stars 472 forks source link

goss doesn't support semantic versioning for custom rpms #334

Open thatsk opened 6 years ago

thatsk commented 6 years ago

Hi, Its nice to use your tool. But there is an bug i have found it doesn't support custom versioing of rpms lets take an example Here is my goss.yaml {code} package: custom-service: installed: true versions:

Failures/Skipped:

Package: custom-service: version: Expected <[]string | len:1, cap:1>: ["5.37.0"] to contain element matching

: 5.37.0-201709220549.68d18f9 Total Duration: 0.044s Count: 4, Failed: 1, Skipped: 0
thatsk commented 6 years ago

need to add here in System->package_rpm.go p.loaded = true cmd := util.NewCommand("rpm", "-q", "--nosignature", "--nohdrchk", "--nodigest", "--qf", "%{VERSION}\n", p.name) if err := cmd.Run(); err != nil { return } p.installed = true p.versions = strings.Split(strings.TrimSpace(cmd.Stdout.String()), "\n")

aelsabbahy commented 6 years ago

Currently for RPM goss only checks the Version, not the Release.

$ rpm -q kernel-4.15.15-300.fc27.x86_64 --qf '%{Version}\n'
4.15.15
$ rpm -q kernel-4.15.15-300.fc27.x86_64 --qf '%{Release}\n'
300.fc27

Need to come up with a good syntax to support Release without breaking backwards compatibility, or rip the bandage off and make a breaking change to change rpm version to %{Version}-%{Release} and cut a major goss release.

Another approach would be to make the matcher special and make it work with both: 4.15.15 and 4.15.15-300.fc27

thatsk commented 5 years ago

When i am cheking on puppet side. its looks its using different syntax which is matching for all type of rpm. /bin/rpm -q rpmname --nosignature --nodigest --qf '%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n'

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

aelsabbahy commented 4 years ago

Epoch (optionally) and release will be in v0.4.0

This would be a breaking change, so waiting on v0.4.0