pytest-testinfra icon indicating copy to clipboard operation
pytest-testinfra copied to clipboard

Support for snap packages.

Open rustyautopsy opened this issue 6 years ago • 5 comments

Are there any plans to extend the Package Class to support the discovery of snap packages?

Or add the ability to work with snap anywhere?

As an example...

The amazon-ssm-agent snap is default in Canonical built AMIs 16.04 and up. Current AWS docs indicate otherwise, however, they need to be updated.

This is forcing us to update our pip tests for amazon-ssm-agent to use a combination of the host.run() calls parsing exit statuses and stdout output.

Is this an acceptable workaround? Is there a better way?

Thanks in advance.

rustyautopsy avatar Jun 28 '18 14:06 rustyautopsy

Hi, I think this should not be in "package" since there is no distribution using snap as default package manager.

But we can implement a "snap_package" module that provide a similar interface for snap packages.

philpep avatar Jun 28 '18 15:06 philpep

Sounds great! At the end of the day, it doesn't matter where/how just as long as it works.

Cheers.

rustyautopsy avatar Jun 28 '18 15:06 rustyautopsy

@rustyautopsy - I'm not sure how this will be perceived but I'm going to try and be constructive.

This type of request bothers me from a testing perspective since you did not provide any example nor provide and documentation of how you use snap and why it is important to you and why it's important that you test it. From a developer perspective I can only assume you want us to read the documentation and implement something but that something isn't a clear use case without examples.

When filling an issue against any project you should assume that no one knows what you are talking about and it's up to you as the issue filer to provide an adequate use case. I find this type of request annoying because as you state "it doesn't matter where/how just as long as it works." what the heck does that even mean? Please do us all a favor and provide an example of what you are trying to accomplish so that we can help. It's frustrating and time consuming to make guesses.

I'm not sure if you will find this constructive or informative but I really want to help you.

FYI - I'm not connected to testinfra in any way, I'm just a python dev that wants to help make testing easier for everyone.

codylane avatar Jun 28 '18 21:06 codylane

@codylane Thanks for taking the time to be constructive. I think the root of your issue(s) start with the line...

"it doesn't matter where/how just as long as it works."

Let me clarify that for you. My initial suggestion was to implement the change within the Package Class. As was mentioned this Class is reserved for default package managers of which snap is not. I have no preference where the ability to support snap is added. I was happy to receive a prompt and helpful response from the project owner and expressed my appreciation, not knowing it would have to be defended ;)

I had hoped that the following statement clarified the use case...

The amazon-ssm-agent snap is default in Canonical built AMIs 16.04 and up. Current AWS docs indicate otherwise, however, they need to be updated.

That should clearly indicate that I am not personally using snap I am using Canonical AMIs which in turn use snap.

Further details to how I am deploying/using testinfra will make sense only in my use case, and as such were purposely omitted.

If you have any further questions or concerns please feel free to contact me directly so we don't pollute this issue further.

rustyautopsy avatar Jul 04 '18 20:07 rustyautopsy

@rustyautopsy - Thanks for going easy on me, I realize that I might have been a little too direct and I hope that I can clarify what I'm looking for so that I can address your concerns regarding snap.

I'm wondering if you can share a small example of how you have been using host.run and what you have to parse so that we can get a better idea of what you are looking for in terms of how you would like snap to behave and how you might like your tests to work?

I've tried the RTFM approach and since I don't have a lot of AWS experience or the ability to spend a bunch of money to setup a test environment in AWS I'm not sure how far this integration will actually go unless we share some use cases on how this might actually work and how we might write some tests.

This may not work for everyone but when I'm asking for new integrations I generally like to show a few examples of what I'm looking to accomplish.

For example if you are using host.run it would be really helpful to understand the following:

  1. What is the full path to the command you are using?
  2. When using snap what does a successful parse, exit code look like? What does an error look like?
  3. Does the snap utility report exit codes (0 == success) and any other is an error?
  4. Could you provide some examples of some mock up test cases that you might like to see for things testinfra should be testing for?
  5. Are there any prerequisites for using snap, i.e. does a service need to be configured and running first? If so, should we be testing that the prerequisites are in good working order every time a do a snap based test?
  6. What versions of linux should this be working on? You mentioned ubuntu, but I see the documentation referencing other linuxes like raspbian centos, amazon linux. The reason I ask is because testing these integrations work, requires a test environment for each flavor of linux it should support which takes time.

So basically what I'm looking for is more information so that we can help.

codylane avatar Jul 12 '18 00:07 codylane