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

WIP: Add 'sti' execute plugin #229

Closed
wants to merge 1 commit into from
Closed

WIP: Add 'sti' execute plugin #229

wants to merge 1 commit into from

Conversation

thrix
Copy link
Collaborator

@thrix thrix commented Apr 30, 2020

Support running sti tests via 'tmt'. Add an template for easily
create the test plan.

Example of the workflow

$ fedpkg clone python3
$ cd python3
$ tmt init --template sti

$ tmt run -a provision -h virtual.testcloud
or
$ tmt run -a provision -h container

Relates to https://pagure.io/fedora-ci/general/issue/4

Still needs some touches:

  • execution in container works
  • ansible failure is considered as test failure

Signed-off-by: Miroslav Vadkerti mvadkert@redhat.com

@thrix thrix requested a review from psss April 30, 2020 23:48
@thrix thrix assigned lukaszachy and thrix and unassigned lukaszachy Apr 30, 2020
@lgtm-com
Copy link

lgtm-com bot commented Apr 30, 2020

This pull request introduces 1 alert when merging 7bb7d1c into 59bf14c - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented May 1, 2020

This pull request introduces 1 alert when merging f42b6f7 into 59bf14c - view on LGTM.com

new alerts:

  • 1 for Unused local variable

Copy link
Collaborator

@psss psss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add the new sti plugin as a dynamic one. In other words, let's finish #227 first and rebase on it. Essential part of an execute plugin is to create the results.yaml file with results which then can be consumed by the report step. Please include generating this file in the implementation as well.

@thrix
Copy link
Collaborator Author

thrix commented May 2, 2020

@psss ah that was the one ;) definitely ... will do ... thanks

@psss
Copy link
Collaborator

psss commented May 4, 2020

Thanks. One more thought: Should we also do sti discover to explore available playbooks so that we can later report which one of them failed/passed?

@thrix thrix changed the title Add 'sti' execute plugin WIP: Add 'sti' execute plugin May 6, 2020
@thrix
Copy link
Collaborator Author

thrix commented May 6, 2020

@psss

Thanks. One more thought: Should we also do sti discover to explore available playbooks so that we can later report which one of them failed/passed?

I was thinking about this, are 2 things to note:

  1. with tests.yml, I was not sure if we want a separate tests.yml for STI plugins, as the current structure is not something applicable here.

  2. we only will support 1 playbook, because if we would more, basically it would mean we have to run each them in clean environment, and that we cannot do and I would like to avoid it.

So I would say we will need to live without discover 'sti', but report should ideally work anyway?

@thrix
Copy link
Collaborator Author

thrix commented May 12, 2020

@psss

Thanks. One more thought: Should we also do sti discover to explore available playbooks so that we can later report which one of them failed/passed?

I was thinking about this, are 2 things to note:

  1. with tests.yml, I was not sure if we want a separate tests.yml for STI plugins, as the current structure is not something applicable here.
  2. we only will support 1 playbook, because if we would more, basically it would mean we have to run each them in clean environment, and that we cannot do and I would like to avoid it.

So I would say we will need to live without discover 'sti', but report should ideally work anyway?

Let's discuss today this topic also @psss

@lgtm-com
Copy link

lgtm-com bot commented May 28, 2020

This pull request introduces 1 alert when merging 510b3ff into bb67195 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@thrix
Copy link
Collaborator Author

thrix commented May 28, 2020

Ok, the code is now on dynamic plugins, seems to work. Now I need to parse out the results from results.yml if around and make sure the result is interpreted fine in case there is no results.yml from STI and we are done \o/

@lgtm-com
Copy link

lgtm-com bot commented May 28, 2020

This pull request introduces 1 alert when merging 31eaa6a into bb67195 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@psss psss added enhancement step | execute Stuff related to the execute step labels May 29, 2020
Copy link
Collaborator

@psss psss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this, @thrix! A couple of comments added.

spec/steps/execute.fmf Show resolved Hide resolved
summary: Execute default playbook
example: |
execute:
how: sti
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Child stories should contain at least a short description. Otherwise it's inherited from parent. You can use make docs to quickly check the final doc output.

self._playbook(),
inventory=self._inventory(guest),
options=f'-e artifacts={self.step.workdir}'
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to run it in this way:

tmt run -avvvddd provision -h virtual execute -h sti

In the middle of test execution a password prompt popped up:

root@192.168.122.54's password:

Not sure where the problem could be.

""" Prepare container using ansible playbook """
playbook = self._ansible_playbook_path(playbook)
inventory = inventory or f'{self.container},'
options = f'{options} ' or ''
local_temp = os.path.expanduser('~/.ansible/tmp')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this used for? Probably add a comment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a leftover.

tmt/steps/execute/sti.py Outdated Show resolved Hide resolved
class ExecutorSTI(tmt.steps.execute.ExecutePlugin):
""" Run tests using ansible according to Standard Test Interface spec """
_doc = """
Execute STI tests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the full STI name here, this is shown in the --help message.

"""


class ExecutorSTI(tmt.steps.execute.ExecutePlugin):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit tests are failing. It would be also nice to include at least a simple tier: 3 test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will add some, keeping open for now

""" Show discover details """
super().show(['playbook'])

def _playbook(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this would be more easily handled by the default() method. See other plugins for inspiration.

hostname = guest.guest or guest.container

inventory_file = os.path.join(
self.step.workdir, f'inventory-{hostname}')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use self.step.write(f'inventory-{hostname}', content) to create a file in the step workdir.


def wake(self):
""" Wake up the plugin (override data with command line) """

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easier way to achieve the same: super().wake(['playbook'])

@lgtm-com
Copy link

lgtm-com bot commented Jun 2, 2020

This pull request introduces 1 alert when merging ba3691a into 8060946 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@psss psss marked this pull request as draft June 9, 2020 15:15
Support running Standard Test Interface tests via 'tmt'.

Example of the workflow

$ fedpkg clone python3
$ cd python3
$ tmt run -a provision -h virtual.testcloud execute -h sti

Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
@lgtm-com
Copy link

lgtm-com bot commented Feb 10, 2021

This pull request introduces 1 alert when merging 3f3301f into 1cbb71e - view on LGTM.com

new alerts:

  • 1 for Unused import

@thrix thrix requested review from psss and removed request for t184256 March 4, 2021 19:06
@thrix
Copy link
Collaborator Author

thrix commented Mar 4, 2021

@psss pls ignore the rerequest for review :) I did not want to do that :)

@psss psss added this to the 1.5 milestone Mar 9, 2021
@thrix
Copy link
Collaborator Author

thrix commented Apr 29, 2021

sorry, infra again :( need to move

@thrix thrix modified the milestones: 1.5, 1.6 Apr 29, 2021
@psss psss removed this from the 1.6 milestone May 31, 2021
@lukaszachy
Copy link
Collaborator

@thrix Hi, Is this still relevant?

@psss
Copy link
Collaborator

psss commented Jul 7, 2022

I'd vote for closing the issue and reopenning only if there is a real need for this.

@thrix thrix removed their assignment Jul 22, 2022
@thrix
Copy link
Collaborator Author

thrix commented Jul 22, 2022

I agree with closing. Let's not complicate our lives with STI. There is more pressing stuff to do. There are no real users for now, I would rather force people to migrate to STI, which we have clear path for.

@thrix thrix closed this Jul 22, 2022
@psss
Copy link
Collaborator

psss commented Jul 22, 2022

would rather force people to migrate to STI

... to migrate "from STI"? ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
step | execute Stuff related to the execute step
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants