-
Notifications
You must be signed in to change notification settings - Fork 2
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
RFC: Remove config/default.tf and default parameters #24
Comments
If I'm not wrong, we pass all variables to terraform specified with |
What parameters doesn't make sense? |
That is good I suppose. @asmorodskyi points out I can remove the input vars, they are not required. The problem is the wording in the README.
Not in my case, this is either static or not controlled by libvirt. Do you really need to set so much stuff dynamically in your scenarios or could you just create separate .tf files? We shouldn't use stuff like vars until we really need them. It is easier to read/debug a static config file for the exact scenario one is testing than one which is full of variable substitutions for things you don't need. I recently burned myself with using var substitution when it wasn't needed, so the pain is fresh in my mind :-).
None of the parameters make sense except 'image' and 'basename'. However I don't want to get stuck discussing my specific scenario. The point is, the more stuff you include in the library that isn't absolutely necessary for most scenarios. The more difficult it is to make it work with some unusual scenario. My suggestion would be to move default.tf to the examples folder. It is definitely useful, but I can imagine default.tf will get very complex and frighten people if it is allowed to evolve. Also shouldn't we be encouraging people to define their infra declaratively with .tf files? This seems to be the main value in using Terraform for me. BTW none of this is blocking me and I probably don't have the full picture yet, I am just noting this down while it is fresh in my mind. |
Ok, I can agree we can remove
I wouldn't like evolving default.tf more than it is now. This is just a way to provide a basic environment. Allowing a user to have an environment without understanding Terraform internals (e.g. how to create a tf file). |
I hope I understood you correct. I just create a custom.tf with a testscript. cfconrad@12da6dd You can run this test with:
Of course you could specify the image also with absolute path inside of the
Regarding static IP's: I think we didn't thought about that. And I don't know if there is a possibility to set the IP directly in the |
Maybe the output thingy could be avoided as well. There is this command |
It's a better approach, so we don't force to use terraform output in the .tf files. We would then need to do careful "greps" to catch the information, but this is very sensitive. See what this command returns:
|
So, basically we would need a parser of |
Yes I think we should give it a try. I think we should check some I'm quite busy, so go ahead :) |
@jlausuch I think you can have two isolated networks with the same IP range. It might make routing a problem depending on the topology connecting the networks, but I think there are ways around it. However in my case DHCP will probably be handled by a windows AD controller anyway.
I would aim to make it easy for the user to get started (e.g. provide examples for common scenarios), but not to allow them to use the tool without beginning to learn Terraform. @cfconrad I guess the library can just return a (maybe empty) dictionary of output values to the tester. Depending on what the .tf file has defined. The general problem I see is that you are trying to do too much for the user at the base level. The Domain class expects that it will be able to get the IP address from Terraform/libvirt. The The Functions in the core API should do as little as possible and have a single obvious effect. You can then have convenience functions which help with the common case and build on the core API.
The main reason I am harassing you with this is because we have repeatedly been burned with these problems in the os-autoinst testapi (e.g. having to generate raw undocumented JSON for the external results tab because the API function both uploads the results from the SUT as well as parse/submit them) and I have also made the same mistakes in JDP. We can refactor later on, but it gets exponentially more expensive as time goes on. |
@richiejp that sounds reasonable to me +1
To this, I would like explore the possibilities with oop in python. |
Mixins look like composition which is my preferred style (regardless of OOP or not), so that is fine by me. The only issue I have with them, I have with Python OOP in general, which is there is no separation between a data 'struct' (like C and Julia) and a class/module containing methods/functions. However Perl OOP generally has the same issue, but it wasn't such an issue for the OpenQA QEMU backend. The trick is to try separating your mostly data classes from your classes containing complex logic. Overriding is good in the case where you have an 'interface' or 'protocol' with a default implementation that does very little and is made to be overridden. When you have a base class (or worse, a chain of super classes) with an implementation which does a lot (and has lots of data properties), then overriding is probably not practical. If you want to create something which does everything for the user, then we probably need to mentally separate the library into two halves. One half is a lightweight, low level, API for doing independent tasks in isolation and another which builds on that API to create a complete, integrated solution for the user. |
I really like, how you bring it down to the general purposes! What I'm currently missing is, what do we consider as low level and were do we start with the upper layer/utilities. Another thing on the table is, do we wont to extend the pytest framework. |
I suppose this is relative and difficult to define. Probably something like 'wait_for_ip'.
I imagine the lower level API could be used with any test framework or none at all. You can simply deploy with terraform during the setup function etc. Then for the 'just works' high level API/framework you can experiment with various approaches. |
Following the example of |
Yeah. At least to begin with, then when I have 3 or more tests with a similar code pattern in I would put this into a higher level function for convenience. |
So I have just started writing a custom TF file and most of the parameters QA Terraform expects simply make no sense for my scenario.
I think we are creating a problem for ourselves by giving QA Terraform the responsibility of defining standard parameters for Terraform files. It would be better to just leave generating the Terraform files to the test writer for now and just pass through
--tvar
arguments to terraform and pass outterraform output
to the test writer.If a very common pattern develops then we can create some special function for that. Otherwise I think we will just end up over-engineering everything.
@jlausuch @asmorodskyi @cfconrad @czerw
The text was updated successfully, but these errors were encountered: