-
Notifications
You must be signed in to change notification settings - Fork 330
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
Add repo state and possibility to specify package name #151
Conversation
@@ -2,9 +2,9 @@ | |||
|
|||
|
|||
def test_package_is_installed(Package): | |||
docker = Package('docker-engine') | |||
docker = Package('docker-ce') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the package name be referenced as variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #153 could you use docker:pkg:name
here (and elsewhere) please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't use a saltstack pillar var in test python code without non-trivial work
assert docker.is_installed | ||
assert docker.version.startswith('1.12.2') | ||
assert docker.version.startswith('18.03.1') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the package version be configurable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #153 could you use docker:pkg:version
here (and elsewhere) please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't use a saltstack pillar var in test python code without non-trivial work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding to what @blbradley says:
I'm particularly reluctanct to use pillar data directly in testing code: I write testing to make sure that the whole formula (states + default pillar data) is correct and does what I expect from it.
To put an example, if I set a "wrong", installable, docker:pkg:version
in the formula, like "17.03.1", and test it, It will work OK, tests will pass.
The "states" are right, but the formula will install "17.03.1" and will not be doing what I want.
I don't know if I'm clear in what I mean...
Again, that's me, and I'm OK doing it the way @noelmcloughlin suggest if you prefer that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @javierbertoli @blbradley I'm okay with not complicating things so leave this as is!! thx
@@ -9,4 +9,17 @@ services: | |||
before_install: | |||
- bundle install | |||
|
|||
script: bundle exec kitchen verify | |||
|
|||
env: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure you need this? I think the matrix is controlled by suiteXplatform in Test Kitchen.
I don't really use this formula anymore but will give some suggestions. |
What version of Docker does the default suite test these days? |
.travis.yml
Outdated
- INSTANCE: default-debian-stretch | ||
- INSTANCE: default-debian-jessie | ||
- INSTANCE: default-centos-7 | ||
- INSTANCE: version-1122-ubuntu-1804 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey I think these names need to start version-18031 now. Right? If you all choose to keep this. This is one reason I let Test Kitchen just control the test matrix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! See the errors in Travis:
No instances for regex
version-1122-ubuntu-1804', try running kitchen list'
Thanks for the quality updates, @javierbertoli. I won't give a 👍 or 👎 on this because I'm not a user of this formula anymore. But I'm happy to answer any questions about the test suite if you hit any trouble. |
Hi @javierbertoli Do you need me to work with you on this? |
Hey, sorry. I'm having some unrelated, Real Life (TM) issues that left me litte time to advance on this 😋 I have some commits that failed local tests, that I need to review and push. I'll see if I can push them today/tomorrow. Is it ok? Or do you prefer I push them as they are, so we can review them? |
@javierbertoli No worries, in your own time!!! Good luck |
e81c6a7
to
2dc17b5
Compare
@noelmcloughlin, @blbradley, updated the PR. Had to remove testing on CentOS, as docker-in-docker fails. Updated to test Debian 8/9 & Ubuntu 18.04. To keep things backward-ish compatible, kept the I think the formula needs a some cleanup and refactoring (ie, I think that Please let me know if you have any suggestions or want anything else done in the PR. |
@@ -1,10 +1,11 @@ | |||
{% from "docker/map.jinja" import docker with context %} | |||
|
|||
{%- if docker.kernel is defined and grains['os_family']|lower == 'debian' %} | |||
pkgrepo dependencies: | |||
pkg.installed: | |||
- name: python-apt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good fix. There is no python-apt
package on non-Debian distros so state fails.
Should we just dump the |
Don't know. If you ask me, I'd dump it, same with the |
Yes - followup would be appreciated if someone can make time. This LGTM as is, and future PR can progress things. Thanks @javierbertoli |
@javierbertoli and @noelmcloughlin merged it. |
This PR tried to address #150, adding a separate state to manage repos
repo.sls
.When testing, found many issues due to old/deprecated versions/repos, so I tried to refactor the formula to be more up-to-date:
Added support for testing on:
Added
osfamilymap.yaml
Updated repo info
This probably can fix/close #109, #150, #131, #136 and #95
I'm not using this formula heavily, so if you can check this PR and make suggestions, any comment will be welcome.
It seems that a lot of refactoring is needed to clean old stuff and perhaps this PR helps to start doing it 😄