-
Notifications
You must be signed in to change notification settings - Fork 205
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
Extend iso post TEST parameter to support a list of tests (poo#10482) #642
Conversation
Missing test. ;) |
Indeed. I guess I'll get to that next week. |
any update? |
Trying that on in t/api/02-iso.t failed: Any hints? |
Start the test as |
@aaannz that helped, thanks. I even start to extend my test. Stay tuned. |
I know the test fails, since it schedules 4 tests. I wonder if this can be right. |
is($ret->tx->res->json->{count}, 3, "3 new jobs created"); | ||
|
||
#print "Job Count: ".$ret->tx->res->json->{count}."\n"; # DEBUG | ||
#print Dumper($ret->tx->res->json->{jobs}); # DEBUG |
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.
please delete disabled code
@aaannz I did it the same way as here: https://github.com/cwh42/openQA/blob/upstream/t/api/02-iso.t#L120 |
Yeah, but that is parsing result from |
I'm not against standardizing these and to prevent breakage you would need to add |
While cleaning up after running 'tidy' I managed to mix up those two lines. |
just for checking the number of jobs you don't need the get call but just check the return value of the post but the problem at hand is that 4 jobs are scheduled when 3 are expected. |
And all 4 match the desired three TEST names. |
my change proposal $ git log -p HEAD^^..
commit cd7898faae8cff4db72a72a88296983d3d04c55c
Author: Oliver Kurz <okurz@suse.de>
Date: Tue May 10 11:15:48 2016 +0200
fixup! Test for "let TEST parameter support a list of tests"
diff --git a/t/api/02-iso.t b/t/api/02-iso.t
index 657f3db..0863907 100644
--- a/t/api/02-iso.t
+++ b/t/api/02-iso.t
@@ -186,7 +186,7 @@ is($ret->tx->res->json->{job}->{state}, 'cancelled', "job $newid is cancelled");
$ret = $t->post_ok('/api/v1/isos', form => {iso => $iso, tests => "kde/usb"})->status_is(400);
# handle list of tests
-my $iso2 = 'openSUSE-13.1-DVD-i586-Build0093-Media.iso';
+my $iso2 = 'openSUSE-13.1-DVD-i586-Build0091-Media.iso';
$ret = $t->post_ok(
'/api/v1/isos',
form => {
@@ -196,14 +196,10 @@ $ret = $t->post_ok(
FLAVOR => 'DVD',
ARCH => 'i586',
TEST => 'server,kde,textmode',
- BUILD => '0093'
+ BUILD => '0091'
})->status_is(200);
-$ret = $t->get_ok('/api/v1/jobs');
-is($ret->tx->res->json->{count}, 3, "3 new jobs created");
-
-#print "Job Count: ".$ret->tx->res->json->{count}."\n"; # DEBUG
-#print Dumper($ret->tx->res->json->{jobs}); # DEBUG
+is($ret->tx->res->json->{count}, 4, "4 new jobs created (one twice for both machine types)");
# delete the iso
# can not do as operator
commit 672f7ad36e34b82b2ee988fd1ec4c58d826984d7
Author: Oliver Kurz <okurz@suse.de>
Date: Tue May 10 11:15:27 2016 +0200
t: Also print machine tag for unambiguous job lists
diff --git a/t/api/02-iso.t b/t/api/02-iso.t
index 0977b68..657f3db 100644
--- a/t/api/02-iso.t
+++ b/t/api/02-iso.t
@@ -48,7 +48,7 @@ sub lj {
my $ret = $t->get_ok('/api/v1/jobs')->status_is(200);
my @jobs = @{$ret->tx->res->json->{jobs}};
for my $j (@jobs) {
- printf "%d %-10s %s\n", $j->{id}, $j->{state}, $j->{name};
+ printf "%d %-10s %s@%s\n", $j->{id}, $j->{state}, $j->{name}, $j->{settings}->{MACHINE};
}
} |
@okurz Patch applied. Test succeeds (at least if run locally). Thanks! |
@@ -27,7 +27,7 @@ use Test::Output qw/stdout_like stderr_like/; | |||
use OpenQA::Test::Case; | |||
use OpenQA::Client; | |||
use Mojo::IOLoop; | |||
use Data::Dump; | |||
use Data::Dumper; |
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.
I think this can be removed, or at least not changed.
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.
To be consequent then, I suggest to also remove other unneeded 'use's:
diff --git a/t/api/02-iso.t b/t/api/02-iso.t
index 0863907..2a0bac6 100644
--- a/t/api/02-iso.t
+++ b/t/api/02-iso.t
@@ -19,15 +19,12 @@ BEGIN {
unshift @inc, 'lib';
}
-use Mojo::Base -strict;
use Test::More;
use Test::Mojo;
use Test::Warnings ':all';
-use Test::Output qw/stdout_like stderr_like/;
use OpenQA::Test::Case;
use OpenQA::Client;
use Mojo::IOLoop;
-use Data::Dumper;
use OpenQA::IPC;
use OpenQA::WebSockets;
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.
yes, in general. Your commit should just change what is necessary, i.e. don't change 'use Data::Dump' as you don't touch this as @aaannz suggested. I think the use Mojo::Base -strict
should be kept. It is like use strict;
The others could be removed if unused now but in another commit.
Now that test is written, I would like to optimize a little. In current implementation you (1) parse |
+1, need to fix test, though |
@@ -124,6 +124,9 @@ sub _generate_jobs { | |||
|
|||
my %wanted; # jobs specified by $args->{TEST} or $args->{MACHINE} or their parents | |||
|
|||
# Allow a comma separated list of tests here; whitespaces allowed | |||
my @tests = split(/\s*,\s*/, $args->{TEST}); |
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.
Undef warning in case of $args->{TEST}
is not present.
Looks better now. |
👍 |
I hope you actually use 'poo' as a short form of 'progress.opensuse.org' ;)