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

Refactor JobTemplates and fix regex substitution #2596

Merged
merged 2 commits into from
Dec 17, 2019

Conversation

perlpunk
Copy link
Contributor

Refactor

Split into subroutines, move code to
OpenQA::Schema:Result::JobGroups
OpenQA::Schema::ResultSet::JobTemplates

This will make testing easier.

Fix substitution for job_templates schedule list

Some templates don't have a final newline, which resulted in the last line not being indented correctly

This is a followup to #2589

Related ticket: https://progress.opensuse.org/issues/60782

Copy link
Member

@okurz okurz left a comment

Choose a reason for hiding this comment

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

+1

@perlpunk perlpunk force-pushed the api/job-templates branch 2 times, most recently from 0143e50 to b57aca3 Compare December 12, 2019 15:24
@perlpunk
Copy link
Contributor Author

I think I need to make another change. Duplicate jobtemplates aren't checked in preview mode now, but there wasn't a test for this yet.

@perlpunk perlpunk force-pushed the api/job-templates branch 2 times, most recently from be76f73 to 4a01efe Compare December 13, 2019 11:34
@perlpunk
Copy link
Contributor Author

I fixed the preview mode.

@perlpunk perlpunk marked this pull request as ready for review December 13, 2019 12:17
@perlpunk perlpunk requested a review from okurz December 13, 2019 12:18
@perlpunk
Copy link
Contributor Author

rebased to master

Copy link
Contributor

@Martchus Martchus left a comment

Choose a reason for hiding this comment

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

Looks good. Only a few style issues (in code you've just moved).

lib/OpenQA/Schema/Result/JobGroups.pm Outdated Show resolved Hide resolved
lib/OpenQA/Schema/Result/JobGroups.pm Outdated Show resolved Hide resolved
lib/OpenQA/Schema/Result/JobGroups.pm Outdated Show resolved Hide resolved
lib/OpenQA/Schema/ResultSet/JobTemplates.pm Outdated Show resolved Hide resolved
Copy link
Member

@kalikiana kalikiana left a comment

Choose a reason for hiding this comment

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

I'm liking the refactor! Not much to criticize about the implementation, although I have a few comments regarding the tests. There should be a brown review state of almost-approved 😉

}

sub expand_yaml {
my ($self, $job_template_names) = @_;
Copy link
Member

Choose a reason for hiding this comment

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

It strikes me as odd that this is sub takes $self but doesn't use it. The result is not the expansion of what's in the group, but the expansion of the given hash. 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I actually thought about putting some functions into their own module because they do not depend on database objects, but skipped it for now.

t/api/08-jobtemplates.t Show resolved Hide resolved
@okurz
Copy link
Member

okurz commented Dec 16, 2019

There should be a brown review state of almost-approved

What I tend to use in these cases is a comment like: "Just this (…) minor issue, then auto-approved" or something :) We should use that more often to not need the additional overhead of "official approval" when it is clear what only remaining trivial issues exist before the approval would be implicit anyway.

Split into subroutines, move code to
OpenQA::Schema::Result::JobGroups
OpenQA::Schema::ResultSet::JobTemplates
Some templates don't have a final newline, which resulted in the last
line not being indented correctly
Copy link
Member

@kalikiana kalikiana left a comment

Choose a reason for hiding this comment

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

Thanks! I'm okay with it as is. The tests can also be extended in another branch!

@okurz
Copy link
Member

okurz commented Dec 16, 2019

So far I found one test that failed:

https://app.circleci.com/jobs/github/perlpunk/openQA/79/parallel-runs/0/steps/0-108

t/25-cache-service.t ........................... 16/? 
    #   Failed test 'job enqueued'
    #   at t/25-cache-service.t line 462.
    # Looks like you failed 1 test of 3.

#   Failed test 'Test Minion Sync task'
#   at t/25-cache-service.t line 471.
Can't call method "perform" on an undefined value at t/25-cache-service.t line 463.
rsync: change_dir "/tmp/4c7ipQOUBc" failed: No such file or directory (2)
rsync: mkdir "/tmp/Z6IJ3ghuij/tests" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at main.c(664) [Receiver=3.1.3]
t/25-cache-service.t ........................... 18/? # Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 255 just after 18.
                                                       t/25-cache-service.t ........................... Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 1/18 subtests 

@perlpunk
Copy link
Contributor Author

So far I found one test that failed:

Hm. the test didn't fail before my style fixes, and also doesn't fail in #2602 which is based on this branch...

@Martchus
Copy link
Contributor

You can try to retrigger that test.

@okurz okurz merged commit f1eaa38 into os-autoinst:master Dec 17, 2019
@perlpunk perlpunk deleted the api/job-templates branch January 2, 2020 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants