From 91ea16c9c0b98c1ddeff4b3e311fc23a7de90cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Buclin?= Date: Tue, 13 Nov 2012 22:29:11 +0100 Subject: [PATCH 01/25] Bug 781850: Do not leak the existence of groups when using User.get() --- t/webservice_user_get.t | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/t/webservice_user_get.t b/t/webservice_user_get.t index 960c45a..70c1f91 100644 --- a/t/webservice_user_get.t +++ b/t/webservice_user_get.t @@ -7,10 +7,11 @@ use warnings; use lib qw(lib); use QA::Util; use QA::Tests qw(PRIVATE_BUG_USER); -use Test::More tests => 180; +use Test::More tests => 228; my ($config, @clients) = get_rpc_clients(); my $get_user = $config->{'unprivileged_user_login'}; +my $canconfirm_user = $config->{'canconfirm_user_login'}; my $priv_user = $config->{PRIVATE_BUG_USER . '_user_login'}; my $disabled = $config->{'disabled_user_login'}; my $disabled_match = substr($disabled, 0, length($disabled) - 1); @@ -68,9 +69,28 @@ my @tests = ( test => 'Specifying just group ids fails', error => 'one of the following parameters', }, - { args => { names => [$get_user, $priv_user], - groups => ['QA-Selenium-TEST'] }, - test => 'Limiting the return value to a group' + { args => { names => [$get_user, $priv_user], groups => ['QA-Selenium-TEST'] }, + test => 'Limiting the return value to a group while being logged out fails', + error => 'The group you specified, QA-Selenium-TEST, is not valid here', + }, + { user => 'unprivileged', + args => { names => [$get_user, $priv_user], groups => ['missing_group'] }, + test => 'Limiting the return value to a group which does not exist fails', + error => 'The group you specified, missing_group, is not valid here', + }, + { user => 'unprivileged', + args => { names => [$get_user, $priv_user], groups => ['QA-Selenium-TEST'] }, + test => 'Limiting the return value to a group you do not belong to fails', + error => 'The group you specified, QA-Selenium-TEST, is not valid here', + }, + { user => 'editbugs', + args => { names => [$get_user, $priv_user], groups => ['canconfirm', 'editbugs'] }, + test => 'Limiting the return value to some groups you do not belong to fails', + error => 'The group you specified, canconfirm, is not valid here', + }, + { user => 'admin', + args => { names => [$canconfirm_user], groups => ['canconfirm', 'editbugs'] }, + test => 'Limiting the return value to groups you belong to', }, # XXX We have no way of getting group_ids from the WebService, so # we can't really test that they work. From 16fe9ae933807c0c0110dd1652c4ade1a00e1323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Buclin?= Date: Tue, 11 Dec 2012 20:51:06 +0100 Subject: [PATCH 02/25] Bug 581690: Restore the ability to move several bugs at once to another installation --- t/test_bug_edit.t | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/t/test_bug_edit.t b/t/test_bug_edit.t index 250b6d8..45ac3b1 100644 --- a/t/test_bug_edit.t +++ b/t/test_bug_edit.t @@ -329,29 +329,23 @@ if ($config->{test_extensions}) { } }); - # Mass-move has been removed, see 581690. - # Restore these tests once this bug is fixed. - # $sel->click_ok("link=My bugs from QA_Selenium"); - # $sel->wait_for_page_to_load_ok(WAIT_TIME); - # $sel->title_is("Bug List: My bugs from QA_Selenium"); - # $sel->is_text_present_ok("2 bugs found"); - # $sel->click_ok("link=Change Several Bugs at Once"); - # $sel->wait_for_page_to_load_ok(WAIT_TIME); - # $sel->title_is("Bug List"); - # $sel->click_ok("check_all"); - # $sel->type_ok("comment", "-> moved"); - # $sel->click_ok('oldbugmove'); - # $sel->wait_for_page_to_load_ok(WAIT_TIME); - # $sel->title_is("Bugs processed"); - # $sel->is_text_present_ok("Bug $bug1_id has been moved to another database"); - # $sel->is_text_present_ok("Bug $bug2_id has been moved to another database"); - # $sel->click_ok("link=Bug $bug2_id"); - # $sel->wait_for_page_to_load_ok(WAIT_TIME); - # $sel->title_like(qr/^Bug $bug2_id/); - # $sel->selected_label_is("resolution", "MOVED"); - - go_to_bug($sel, $bug2_id); - edit_bug_and_return($sel, $bug2_id, $bug_summary2, {id => "oldbugmove"}); + $sel->click_ok("link=My bugs from QA_Selenium"); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_is("Bug List: My bugs from QA_Selenium"); + $sel->is_text_present_ok("2 bugs found"); + $sel->click_ok("link=Change Several Bugs at Once"); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_is("Bug List"); + $sel->click_ok("check_all"); + $sel->type_ok("comment", "-> moved"); + $sel->click_ok('oldbugmove'); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_is("Bugs processed"); + $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); + $sel->is_text_present_ok("Changes submitted for bug $bug2_id"); + $sel->click_ok("link=bug $bug2_id"); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_like(qr/^Bug $bug2_id/); $sel->selected_label_is("resolution", "MOVED"); $sel->is_text_present_ok("Bug moved to http://www.foo.com/."); From b8fe7817a861fc0dd8625504f06952e389030dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Buclin?= Date: Mon, 17 Dec 2012 22:54:16 +0100 Subject: [PATCH 03/25] Bug 357429: Renaming a group which plays a special role should work fine Bug 349855: Deleting a group which plays a special role must be rejected --- t/test_groups.t | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/t/test_groups.t b/t/test_groups.t index c979ff1..3fd4062 100644 --- a/t/test_groups.t +++ b/t/test_groups.t @@ -265,6 +265,66 @@ $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Confirm Group Control Change for product 'TestProduct'"); $sel->is_text_present_ok("the group is no longer applicable and will be removed"); +# Make sure that renaming a group which is used as a special group +# (such as insidergroup or querysharegroup) is correctly propagated +# and that you cannot delete this group. + +set_parameters($sel, { "Group Security" => {"querysharegroup" => {type => "select", value => "Selenium-test"}} }); + +go_to_admin($sel); +$sel->click_ok("link=Groups"); +$sel->wait_for_page_to_load(WAIT_TIME); +$sel->title_is("Edit Groups"); +$sel->click_ok("link=Selenium-test"); +$sel->wait_for_page_to_load(WAIT_TIME); +$sel->title_is("Change Group: Selenium-test"); +$sel->type_ok("name", "X-Selenium-Y"); +$sel->click_ok("update-group"); +$sel->wait_for_page_to_load(WAIT_TIME); +$sel->title_is("Change Group: X-Selenium-Y"); +$sel->is_text_present_ok("The name was changed to 'X-Selenium-Y'"); + +go_to_admin($sel); +$sel->click_ok("link=Parameters"); +$sel->wait_for_page_to_load(WAIT_TIME); +$sel->title_is("Configuration: Required Settings"); +$sel->click_ok("link=Group Security"); +$sel->wait_for_page_to_load(WAIT_TIME); +$sel->title_is("Configuration: Group Security"); +$sel->value_is("querysharegroup", "X-Selenium-Y"); + +# There is no UI to delete this group, so we have to type the URL directly. + +$sel->open_ok("/$config->{bugzilla_installation}/editgroups.cgi?action=del&group=$group_id"); +$sel->title_is("Group not deletable"); +$sel->is_text_present_ok("The group 'X-Selenium-Y' is used by the 'querysharegroup' parameter"); + +$sel->open_ok("/$config->{bugzilla_installation}/editgroups.cgi?action=delete&group=$group_id"); +$sel->title_is("Suspicious Action"); +$sel->is_text_present_ok("you have no valid token for the delete_group action while processing the 'editgroups.cgi' script"); +$sel->click_ok("confirm"); +$sel->wait_for_page_to_load(WAIT_TIME); +$sel->title_is("Group not deletable"); +$sel->is_text_present_ok("The group 'X-Selenium-Y' is used by the 'querysharegroup' parameter"); + +set_parameters($sel, { "Group Security" => {"querysharegroup" => {type => "select", value => ""}} }); + +# Revert the group name change to not mess with the subsequent tests +# which expect to see 'Selenium-test'. + +go_to_admin($sel); +$sel->click_ok("link=Groups"); +$sel->wait_for_page_to_load(WAIT_TIME); +$sel->title_is("Edit Groups"); +$sel->click_ok("link=X-Selenium-Y"); +$sel->wait_for_page_to_load(WAIT_TIME); +$sel->title_is("Change Group: X-Selenium-Y"); +$sel->type_ok("name", "Selenium-test"); +$sel->click_ok("update-group"); +$sel->wait_for_page_to_load(WAIT_TIME); +$sel->title_is("Change Group: Selenium-test"); +$sel->is_text_present_ok("The name was changed to 'Selenium-test'"); + # Delete the Selenium-test group. go_to_admin($sel); From 7e5cec88915bf50b992889f4d4d95a71b1348734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Buclin?= Date: Fri, 20 Dec 2013 17:23:43 +0100 Subject: [PATCH 04/25] Add support for JSON::RPC 1.01 and newer --- t/lib/QA/RPC/JSONRPC.pm | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/t/lib/QA/RPC/JSONRPC.pm b/t/lib/QA/RPC/JSONRPC.pm index e394b36..2483ec6 100644 --- a/t/lib/QA/RPC/JSONRPC.pm +++ b/t/lib/QA/RPC/JSONRPC.pm @@ -2,7 +2,19 @@ package QA::RPC::JSONRPC; use strict; -use base qw(QA::RPC JSON::RPC::Client); + +use QA::RPC; +BEGIN { + our @ISA = qw(QA::RPC); + + if (eval { require JSON::RPC::Client }) { + push(@ISA, 'JSON::RPC::Client'); + } + else { + require JSON::RPC::Legacy::Client; + push(@ISA, 'JSON::RPC::Legacy::Client'); + } +} use URI::Escape; @@ -102,8 +114,16 @@ sub _get { package QA::RPC::JSONRPC::ReturnObject; use strict; -use JSON::RPC::Client; -use base qw(JSON::RPC::ReturnObject); + +BEGIN { + if (eval { require JSON::RPC::Client }) { + our @ISA = qw(JSON::RPC::ReturnObject); + } + else { + require JSON::RPC::Legacy::Client; + our @ISA = qw(JSON::RPC::Legacy::ReturnObject); + } +} ################################# # Consistency with XMLRPC::Lite # From d91cde15340fccbb34a99eeea530ef86d987dd55 Mon Sep 17 00:00:00 2001 From: Sunil Joshi Date: Mon, 24 Feb 2014 14:06:29 +0100 Subject: [PATCH 05/25] Bug 558803: Add admin options for specifying/requiring password complexity in various forms r=LpSolit --- t/test_password_complexity.t | 113 +++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 t/test_password_complexity.t diff --git a/t/test_password_complexity.t b/t/test_password_complexity.t new file mode 100644 index 0000000..b8b2187 --- /dev/null +++ b/t/test_password_complexity.t @@ -0,0 +1,113 @@ +use strict; +use warnings; +use lib qw(lib); + +use Test::More "no_plan"; + +use QA::Util; + +my ($sel, $config) = get_selenium(); +log_in($sel, $config, 'admin'); + +set_parameters($sel, {"Administrative Policies" => {"allowuserdeletion-on" => undef}, + "User Authentication" => {"createemailregexp" => {type => "text", value => '.*'}, + "emailsuffix" => {type => "text", value => ''}} }); + +# Set the password complexity to MIXED LETTERS. +# Password must contain at least one UPPER and one lowercase letter. +my @invalid_mixed_letter = qw(lowercase UPPERCASE 1234567890 123lowercase + 123UPPERCASE !@%&^lower !@&^UPPER); + +check_passwords($sel, 'mixed_letters', \@invalid_mixed_letter, ['PaSSwOrd', '%9rT#j22S']); + +# Set the password complexity to LETTERS AND NUMBERS. +# Passwords must contain at least one UPPER and one lower case letter and a number. +my @invalid_letter_number = (@invalid_mixed_letter, qw(lowerUPPER 123!@%^$)); + +check_passwords($sel, 'letters_numbers', \@invalid_letter_number, ['-UniCode6.3', 'UNO54sun']); + +# Set the password complexity to LETTERS, NUMBERS AND SPECIAL CHARACTERS. +# Passwords must contain at least one letter, a number and a special character. +my @invalid_letter_number_splchar = (qw(!@%^&~* lowerUPPER123), @invalid_letter_number); + +check_passwords($sel, 'letters_numbers_specialchars', \@invalid_letter_number_splchar, ['@gu731', 'HU%m70?']); + +# Set the password complexity to No Constraints. +check_passwords($sel, 'no_constraints', ['12xY!', 'aaaaa'], ['aaaaaaaa', '>F12Xy?']); + +logout($sel); + + +sub check_passwords { + my ($sel, $param, $invalid_passwords, $valid_passwords) = @_; + + set_parameters($sel, { "User Authentication" => {"password_complexity" => {type => "select", value => $param}} }); + my $new_user = 'selenium-' . random_string(10) . '@bugzilla.org'; + + go_to_admin($sel); + $sel->click_ok("link=Users"); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_is('Search users'); + $sel->click_ok('link=add a new user'); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_is('Add user'); + $sel->type_ok('login', $new_user); + + foreach my $password (@$invalid_passwords) { + $sel->type_ok('password', $password, 'Enter password'); + $sel->click_ok('add'); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + if ($param eq 'no_constraints') { + $sel->title_is('Password Too Short'); + } + else { + $sel->title_is('Password Fails Requirements'); + } + + my $error_msg = trim($sel->get_text("error_msg")); + if ($param eq 'mixed_letters') { + ok($error_msg =~ /UPPERCASE letter.*lowercase letter/, + "Mixed letter password fails requirement: $password"); + } + elsif ($param eq 'letters_numbers') { + ok($error_msg =~ /UPPERCASE letter.*lowercase letter.*digit/, + "Letter & Number password fails requirement: $password"); + + } + elsif ($param eq 'letters_numbers_specialchars') { + ok($error_msg =~ /letter.*special character.*digit/, + "Letter, Number & Special Character password fails requirement: $password"); + } + else { + ok($error_msg =~ /The password must be at least \d+ characters long/, + "Password Too Short: $password"); + } + $sel->go_back_ok(); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + } + + my $created = 0; + + foreach my $password (@$valid_passwords) { + $sel->type_ok('password', $password, 'Enter password'); + $sel->click_ok($created ? 'update' : 'add'); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_is($created ? "User $new_user updated" : "Edit user $new_user"); + my $msg = trim($sel->get_text('message')); + if ($created++) { + ok($msg =~ /A new password has been set/, 'Account updated'); + } + else { + ok($msg =~ /The user account $new_user has been created successfully/, 'Account created'); + } + } + + return unless $created; + + $sel->click_ok('delete'); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_is("Confirm deletion of user $new_user"); + $sel->click_ok('delete'); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_is("User $new_user deleted"); +} From e13f5a6a1f79004a774687325c1e18b06980328a Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Fri, 2 May 2014 15:39:59 +0000 Subject: [PATCH 06/25] Bug 983275 - Switch Bugzilla's CI testing from Tinderbox to travis-ci --- config/bugzilla.conf | 10 +++ config/checksetup_answers.txt | 12 ++++ config/selenium_test.conf | 2 +- travis.sh | 132 ++++++++++++++++++++++++++++++++++ 4 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 config/bugzilla.conf create mode 100644 config/checksetup_answers.txt create mode 100755 travis.sh diff --git a/config/bugzilla.conf b/config/bugzilla.conf new file mode 100644 index 0000000..c4f00b3 --- /dev/null +++ b/config/bugzilla.conf @@ -0,0 +1,10 @@ + + DocumentRoot %TRAVIS_BUILD_DIR% + Alias /bugzilla %TRAVIS_BUILD_DIR% + + AddHandler cgi-script .cgi + Options +Indexes +ExecCGI +FollowSymLinks + DirectoryIndex index.cgi + AllowOverride Limit Options FileInfo + + diff --git a/config/checksetup_answers.txt b/config/checksetup_answers.txt new file mode 100644 index 0000000..2636bcd --- /dev/null +++ b/config/checksetup_answers.txt @@ -0,0 +1,12 @@ + $answer{'db_host'} = 'localhost'; + $answer{'db_driver'} = 'Sqlite'; + $answer{'db_port'} = 0; + $answer{'db_name'} = 'bugs'; + $answer{'db_user'} = 'bugs'; + $answer{'db_pass'} = ''; + $answer{'urlbase'} = 'http://localhost/bugzilla/'; + $answer{'webservergroup'} = '%USER%'; + $answer{'ADMIN_EMAIL'} = 'admin@my.company'; + $answer{'ADMIN_PASSWORD'} = '******'; + $answer{'ADMIN_REALNAME'} = 'admin'; + $answer{'NO_PAUSE'} = 1; diff --git a/config/selenium_test.conf b/config/selenium_test.conf index 29ed8f3..17857da 100644 --- a/config/selenium_test.conf +++ b/config/selenium_test.conf @@ -10,7 +10,7 @@ 'port' => 4444, 'browser_url' => 'http://localhost', 'bugzilla_installation' => 'bugzilla', - 'bugzilla_path' => '/path/to/bugzilla/dir', + 'bugzilla_path' => '%TRAVIS_BUILD_DIR%', 'admin_user_login' => 'admin@my.company', 'admin_user_passwd' => '******', 'admin_user_username' => 'admin', diff --git a/travis.sh b/travis.sh new file mode 100755 index 0000000..fdc3141 --- /dev/null +++ b/travis.sh @@ -0,0 +1,132 @@ +#!/bin/bash +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +QA_REPO="dklawren/qa" +QA_BRANCH="$TRAVIS_BRANCH" + +# Setup starts here +cd $TRAVIS_BUILD_DIR + +# Package installation section +echo "== Installing OS packages" +sudo apt-get install -y perlmagick apache2 libssl-dev g++ libgd2-xpm-dev xvfb + +if [ "$TEST_SUITE" = "docs" ]; then + if [ "$TRAVIS_BRANCH" = "master" ]; then + sudo apt-get install -y python-sphinx + elif [ "$TRAVIS_BRANCH" = "4.4" ]; then + sudo apt-get install -y xmlto lynx texlive-lang-cyrillic + else + sudo apt-get install -y ldp-docbook-dsssl jade jadetex lynx + export JADE_PUB=/usr/share/sgml/declaration + export LDP_HOME=/usr/share/sgml/docbook/stylesheet/dsssl/ldp + fi +fi + +if [ "$TEST_SUITE" = "selenium" ] || [ "$TEST_SUITE" = "webservices" ]; then + sudo apt-get install -y apache2 xvfb +fi + +# Install dependencies from Build.PL +echo "== Installing Perl dependencies" +cpanm --quiet --notest --reinstall DateTime +cpanm --quiet --notest --reinstall Module::Build # Need latest build +cpanm --quiet --notest --reinstall Software::License # Needed by Module::Build +cpanm --quiet --notest --reinstall Pod::Coverage +cpanm --quiet --notest --installdeps --with-recommends . + +# Basic sanity tests +if [ "$TEST_SUITE" = "sanity" ]; then + echo "== Running sanity tests" + perl Build.PL + ./Build + ./Build test + exit $? +fi + +# Documentation build testing +if [ "$TEST_SUITE" = "docs" ]; then + echo "== Running documentation build" + cd docs + perl makedocs.pl --with-pdf + exit $? +fi + +# Switch to the correct branch for the QA repo +if [ "$TRAVIS_BRANCH" != "master" ]; then + echo "== Switch to the proper $TRAVIS_BRANCH QA branch for extended tests" + cd $TRAVIS_BUILD_DIR/qa + git checkout $TRAVIS_BRANCH + if [ ! -f config/selenium_test.conf ]; then + exit 1 + fi + cd $TRAVIS_BUILD_DIR +fi + +# We need to replace some variables in the config files from the Travis CI environment +echo "== Updating config files" +sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place qa/config/selenium_test.conf +sed -e "s?%USER%?$USER?g" --in-place qa/config/checksetup_answers.txt + +# Configure Apache to serve from our build directory and restart +sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place qa/config/bugzilla.conf +sudo cp qa/config/bugzilla.conf /etc/apache2/sites-available/default +sudo sed -e "s?APACHE_RUN_USER=www-data?APACHE_RUN_USER=$USER?g" --in-place /etc/apache2/envvars +sudo sed -e "s?APACHE_RUN_GROUP=www-data?APACHE_RUN_GROUP=$USER?g" --in-place /etc/apache2/envvars +sudo service apache2 stop; sudo rm -rf /var/lock/apache2; sudo service apache2 start + +# Link /usr/bin/perl to the current perlbrew perl so that the Bugzilla cgi scripts will work properly +# PERLBREW_ROOT and PERLBREW_PERL are set by the perlbrew binary when switch perl versions +echo "== Fixing Perl" +sudo mv /usr/bin/perl /usr/bin/perl.bak +sudo ln -s $PERLBREW_ROOT/perls/$PERLBREW_PERL/bin/perl /usr/bin/perl + +# We will be using SQLite for our database backend +cpanm --quiet --notest DBD::SQLite + +# We have to run checksetup.pl twice as the first run creates localconfig +perl checksetup.pl qa/config/checksetup_answers.txt +perl checksetup.pl qa/config/checksetup_answers.txt + +# Create test data in the SQLite database for use by the extended test suite +cd $TRAVIS_BUILD_DIR/qa/config +perl -Mlib=$TRAVIS_BUILD_DIR/lib generate_test_data.pl +cd $TRAVIS_BUILD_DIR/qa/t + +# Selenium UI Tests +if [ "$TEST_SUITE" = "selenium" ]; then + # This is needed for the selenium tests + cpanm --quiet --notest Test::WWW::Selenium + + # Selenium setup + if [ "$TEST_SUITE" = "selenium" ]; then + # Start the virtual frame buffer + echo "== Starting virtual frame buffer" + export DISPLAY=:99.0 + sh -e /etc/init.d/xvfb start + sleep 5 + + # Download and start the selenium server + echo "== Downloading and starting Selenium server" + wget http://selenium-release.storage.googleapis.com/2.41/selenium-server-standalone-2.41.0.jar + sudo java -jar selenium-server-standalone-2.41.0.jar 1> /dev/null & + sleep 5 + + echo "== Running Selenium UI tests" + perl -Mlib=$TRAVIS_BUILD_DIR/lib /usr/bin/prove -v -j4 -I$TRAVIS_BUILD_DIR/lib test_*.t + exit $? +fi + +# WebService Tests +if [ "$TEST_SUITE" = "webservices" ]; then + echo "== Running WebService tests" + perl -Mlib=$TRAVIS_BUILD_DIR/lib /usr/bin/prove -v -I$TRAVIS_BUILD_DIR/lib webservice_*.t + exit $? +fi + +exit 0 From 9e88209179ab329742e3515606a97c9ddde022f3 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Fri, 2 May 2014 18:22:34 +0000 Subject: [PATCH 07/25] Bug 983275 - Switch Bugzilla's CI testing from Tinderbox to travis-ci - Need to manually install XMLRPC::Lite for versions 4.2 and earlier due to the SOAP::Lite split --- travis.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/travis.sh b/travis.sh index fdc3141..b61ca1d 100755 --- a/travis.sh +++ b/travis.sh @@ -38,6 +38,7 @@ cpanm --quiet --notest --reinstall DateTime cpanm --quiet --notest --reinstall Module::Build # Need latest build cpanm --quiet --notest --reinstall Software::License # Needed by Module::Build cpanm --quiet --notest --reinstall Pod::Coverage +cpanm --quiet --notest --reinstall XMLRPC::Lite # Needed for version 4.2 and earlier cpanm --quiet --notest --installdeps --with-recommends . # Basic sanity tests From 2bf25f19f8bf53240fec22f355b599fd0aa42772 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Fri, 2 May 2014 20:29:48 +0000 Subject: [PATCH 08/25] Bug 983275 - Switch Bugzilla's CI testing from Tinderbox to travis-ci - Fixed syntax error in travis.sh --- travis.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/travis.sh b/travis.sh index b61ca1d..52cc172 100755 --- a/travis.sh +++ b/travis.sh @@ -104,8 +104,6 @@ if [ "$TEST_SUITE" = "selenium" ]; then # This is needed for the selenium tests cpanm --quiet --notest Test::WWW::Selenium - # Selenium setup - if [ "$TEST_SUITE" = "selenium" ]; then # Start the virtual frame buffer echo "== Starting virtual frame buffer" export DISPLAY=:99.0 From a7f1de9e99732d8593911f473f395eebacb3f0c2 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Fri, 2 May 2014 21:15:09 +0000 Subject: [PATCH 09/25] Bug 983275 - Switch Bugzilla's CI testing from Tinderbox to travis-ci - Fixed dependency issue --- travis.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/travis.sh b/travis.sh index 52cc172..f5726f4 100755 --- a/travis.sh +++ b/travis.sh @@ -90,6 +90,9 @@ sudo ln -s $PERLBREW_ROOT/perls/$PERLBREW_PERL/bin/perl /usr/bin/perl # We will be using SQLite for our database backend cpanm --quiet --notest DBD::SQLite +# This is needed for the extended test suite +cpanm --quiet --notest Test::WWW::Selenium + # We have to run checksetup.pl twice as the first run creates localconfig perl checksetup.pl qa/config/checksetup_answers.txt perl checksetup.pl qa/config/checksetup_answers.txt @@ -101,9 +104,6 @@ cd $TRAVIS_BUILD_DIR/qa/t # Selenium UI Tests if [ "$TEST_SUITE" = "selenium" ]; then - # This is needed for the selenium tests - cpanm --quiet --notest Test::WWW::Selenium - # Start the virtual frame buffer echo "== Starting virtual frame buffer" export DISPLAY=:99.0 From 08632b6c2c05bfbb0a83c2dd907c7bce9c9c3bc3 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 7 May 2014 16:10:25 +0000 Subject: [PATCH 10/25] Bug 983275 - Switch Bugzilla's CI testing from Tinderbox to travis-ci --- config/checksetup_answers.txt | 18 +- config/checksetup_upgrade_answers.txt | 24 ++ config/config-checksetup-mysql | 119 +++++++++ test-checksetup.pl | 347 ++++++++++++++++++++++++++ travis.sh | 58 +++-- 5 files changed, 545 insertions(+), 21 deletions(-) create mode 100644 config/checksetup_upgrade_answers.txt create mode 100755 config/config-checksetup-mysql create mode 100755 test-checksetup.pl diff --git a/config/checksetup_answers.txt b/config/checksetup_answers.txt index 2636bcd..4a8be85 100644 --- a/config/checksetup_answers.txt +++ b/config/checksetup_answers.txt @@ -1,10 +1,22 @@ $answer{'db_host'} = 'localhost'; - $answer{'db_driver'} = 'Sqlite'; + $answer{'db_driver'} = 'mysql'; $answer{'db_port'} = 0; $answer{'db_name'} = 'bugs'; $answer{'db_user'} = 'bugs'; - $answer{'db_pass'} = ''; - $answer{'urlbase'} = 'http://localhost/bugzilla/'; + $answer{'db_pass'} = 'bugs'; + $answer{'db_sock'} = ''; + $answer{'db_check'} = 1; + $answer{'db_mysql_ssl_ca_file'} = ''; + $answer{'db_mysql_ssl_ca_path'} = ''; + $answer{'db_mysql_ssl_client_cert'} = ''; + $answer{'db_mysql_ssl_client_key'} = ''; + $answer{'urlbase'} = 'http://localhost/bugzilla/'; + $answer{'create_htaccess'} = ''; + $answer{'use_suexec'} = ''; + $answer{'index_html'} = 0; + $answer{'cvsbin'} = '/usr/bin/cvs'; + $answer{'interdiffbin'} = '/usr/bin/interdiff'; + $answer{'diffpath'} = '/usr/bin'; $answer{'webservergroup'} = '%USER%'; $answer{'ADMIN_EMAIL'} = 'admin@my.company'; $answer{'ADMIN_PASSWORD'} = '******'; diff --git a/config/checksetup_upgrade_answers.txt b/config/checksetup_upgrade_answers.txt new file mode 100644 index 0000000..fb78b06 --- /dev/null +++ b/config/checksetup_upgrade_answers.txt @@ -0,0 +1,24 @@ + $answer{'db_host'} = 'localhost'; + $answer{'db_driver'} = 'mysql'; + $answer{'db_port'} = 0; + $answer{'db_name'} = 'bugs_checksetup'; + $answer{'db_user'} = 'bugs'; + $answer{'db_pass'} = 'bugs'; + $answer{'db_sock'} = ''; + $answer{'db_check'} = 1; + $answer{'db_mysql_ssl_ca_file'} = ''; + $answer{'db_mysql_ssl_ca_path'} = ''; + $answer{'db_mysql_ssl_client_cert'} = ''; + $answer{'db_mysql_ssl_client_key'} = ''; + $answer{'urlbase'} = 'http://localhost/bugzilla/'; + $answer{'create_htaccess'} = ''; + $answer{'use_suexec'} = ''; + $answer{'index_html'} = 0; + $answer{'cvsbin'} = '/usr/bin/cvs'; + $answer{'interdiffbin'} = '/usr/bin/interdiff'; + $answer{'diffpath'} = '/usr/bin'; + $answer{'webservergroup'} = '%USER%'; + $answer{'ADMIN_EMAIL'} = 'admin@my.company'; + $answer{'ADMIN_PASSWORD'} = '******'; + $answer{'ADMIN_REALNAME'} = 'admin'; + $answer{'NO_PAUSE'} = 1; diff --git a/config/config-checksetup-mysql b/config/config-checksetup-mysql new file mode 100755 index 0000000..53a9f3f --- /dev/null +++ b/config/config-checksetup-mysql @@ -0,0 +1,119 @@ +use strict; +use warnings; + +use constant CONFIG => { + base_dir => '%TRAVIS_BUILD_DIR%', + test_db => 'bugs_checksetup', + tip_db => 'bugs_tip', + db_type => 'MySQL', + db_user => 'bugs', + db_pass => 'bugs', + answers => 'qa/config/checksetup_upgrade_answers.txt', + test_user_login => 'checksetup_test_user@my.company', + test_real_name => 'Checksetup Test User', + dump_file_url => 'https://people.mozilla.org/~dkl/tinderbox/dumps/mysql', + + # Databases bugs_tip and bugs_bugzilla4_[024]_branch are replicated from + # landfill so no need to copy them manually (which takes about 500+200 sec) + #copy_dbs => [qw()], + # + # I don't think there are going to be any more DB changes on + # these branches. + # bugs_bugzilla3_4_branch + # bugs_bugzilla3_2_branch + # bugs_bugzilla3_0_branch + # bugs_bugzilla2_22_branch + # bugs_bugzilla2_20_branch + # bugs_bugzilla2_18_branch + # + # All odd-numbered versions are development releases and won't be tested + # because we don't support upgrades from them and this saves test cycles. + # + # Due to hd crash, we lost test databases marked with #### + # + db_list => { + # This is 2.08 so that it sorts properly. + # Upgrades from 2.8 are no longer supported. + #'2.08' => 'bugs_2_8', +#### '2.09' => 'bugs_2_9', +#### '2.10' => 'bugs_2_10', +#### '2.12' => 'bugs_2_12', +#### '2.13' => 'bugs_2_13', +#### '2.14' => 'bugs_2_14', + '2.14.1' => 'bugs_2_14_1', + '2.14.2' => 'bugs_2_14_2', + '2.14.x' => 'bugs_2_14_branch', + '2.16' => 'bugs_2_16', +#### '2.16.1' => 'bugs_2_16_1_ru', +#### '2.16.3' => 'bugs_2_16_3', +#### '2.16.4' => 'bugs_2_16_4', +#### '2.16.5' => 'bugs_2_16_5', +#### '2.16.6' => 'bugs_2_16_6', +#### '2.16.11' => 'bugs_2_16_11', + '2.16.x' => 'bugs_2_16_branch', + #'2.17.1' => 'bugs_2_17_1', + #'2.17.3' => 'bugs_2_17_3', + #'2.17.4' => 'bugs_2_17_4es', + #'2.17.5' => 'bugs_2_17_5', + #'2.17.6' => 'bugs_2_17_6', + #'2.17.7' => 'bugs_2_17_7', +#### '2.18rc1' => 'bugs_2_18_rc1', + # There were no significant checksetup changes between 2.18rc1 and 2.18rc2 +#### '2.18rc3' => 'bugs_2_18_rc3', +#### '2.18.1' => 'bugs_2_18_1', +#### '2.18.2' => 'bugs_2_18_2', +#### '2.18.4' => 'bugs_2_18_4', +#### '2.18.5' => 'bugs_2_18_5', + '2.18.x' => 'bugs_2_18_branch', + #'2.19.1' => 'bugs_2_19_1', + # 2.19.2 was during the "original 2.20 freeze", so no important changes. + #'2.19.3' => 'bugs_2_19_3', +#### '2.20rc1' => 'bugs_2_20rc1', +#### '2.20rc2' => 'bugs_2_20rc2', +#### '2.20' => 'bugs_2_20', +#### '2.20.1' => 'bugs_2_20_1', + # No checksetup changes in 2.20.2-2.20.4. + '2.20.x' => 'bugs_2_20_branch', + #'2.21.1' => 'bugs_2_21', +#### '2.22rc1' => 'bugs_2_22rc1', + # No difference in checksetup between 2.22rc1 and 2.22. +#### '2.22.1' => 'bugs_2_22_1', + '2.22.x' => 'bugs_2_22_branch', + #'2.23.1' => 'bugs_2_23_1', + #'2.23.2' => 'bugs_2_23_2', + #'2.23.3' => 'bugs_2_23_3', + #'2.23.4' => 'bugs_2_23_4', +#### '3.0' => 'bugs_3_0', + # No difference in checksetup between 3.0 and 3.0.1 + '3.0.x' => 'bugs_3_0_branch', + #'3.1.1' => 'bugs_3_1_1', + #'3.1.2' => 'bugs_3_1_2', + #'3.1.4' => 'bugs_3_1_4', +#### '3.2rc1' => 'bugs_3_2rc1', + # No DB changes between 3.2rc1 and 3.2 + '3.2.x' => 'bugs_3_2_branch', + #'3.3.1' => 'bugs_3_3_1', + #'3.3.4' => 'bugs_3_3_4', + '3.4.x' => 'bugs_3_4_branch', + #'3.5.1' => 'bugs_3_5_1', + #'3.5.3' => 'bugs_3_5_3', +#### '3.6' => 'bugs_3_6', + '3.6.x' => 'bugs_3_6_branch', + #'3.7.1' => 'bugs_3_7_1', + #'3.7.2' => 'bugs_3_7_2', + #'3.7.3' => 'bugs_3_7_3', +#### '4.0.11' => 'bugs_4_0_11', + '4.0.x' => 'bugs_4_0_branch', + #'4.1.1' => 'bugs_4_1_1', + # No DB changes between 4.1.1 and 4.1.2 + #'4.1.3' => 'bugs_4_1_3', +#### '4.2rc1' => 'bugs_4_2rc1', +#### '4.2.7' => 'bugs_4_2_7', + '4.2.x' => 'bugs_4_2_branch', + # No DB changes between 4.4rc2 and 4.4 or 4.4 and 4.4.1 +#### '4.4.1' => 'bugs_4_4_1', + '4.4.x' => 'bugs_4_4_branch', + }, +}; + +1; diff --git a/test-checksetup.pl b/test-checksetup.pl new file mode 100755 index 0000000..83badf9 --- /dev/null +++ b/test-checksetup.pl @@ -0,0 +1,347 @@ +#!/usr/bin/perl +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +use warnings; +use strict; + +use FindBin qw($RealBin); +use lib ($RealBin, "$RealBin/t/lib"); + +use Carp; +use File::Basename; +use File::Path; +use Getopt::Long; +use QA::DB; + +set_env(); + +##################################################################### +# Constants +##################################################################### + +my %switch; +GetOptions(\%switch, 'full', 'skip-basic', 'config:s'); + +my $config_file = $switch{config} || 'config-test-checksetup'; +require $config_file; + +# Set up some global constants. +our $config = CONFIG(); +our $test_db_name = $config->{test_db}; +our $tip_database = $test_db_name . "_tiptest"; +our $answers_file = $config->{answers}; +our $dump_file_url = $config->{dump_file_url}; + +# Configuration for the detailed tests + +# How many of each object we create while we're testing the created database. +# The larger this number is, the longer the tests will take, but the more +# thorough they will be. +our $object_limit = 500; + +# The login name and realname for the user that we create in the database +# during testing. +our $test_user_login = $config->{test_user_login}; +our $test_real_name = $config->{test_real_name}; + +my %db_list = %{$config->{db_list}}; + +##################################################################### +# Subroutines +##################################################################### + +sub set_env { + $ENV{PATH} = '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin'; + $ENV{PGOPTIONS}='-c client_min_messages=warning'; +} + +our $_db; +sub db { + return $_db ||= QA::DB->new({ db_type => $config->{db_type}, + user => $config->{db_user}, + password => $config->{db_pass} }); +} + +sub check_schema ($$) { + my ($for_db, $version_db) = @_; + $version_db = '(checksetup-created)' unless $version_db; + + my $diffs = db()->diff_schema($tip_database, $for_db); + if ($diffs) { + print STDERR "\nWARNING: Differences found between $version_db" + . " and $tip_database:\n\n"; + print STDERR $diffs; + } +} + +sub check_test ($$) { + my ($test_name, $failures) = @_; + if ($failures) { + print STDERR "\n\n***** $test_name FAILED! *****\n\n"; + $::total_failures += $failures; + } +} + +# Runs checksetup against the specified DB. Returns the number of times +# that the tests failed. If you specify no DB, we will create an empty +# DB and test against that. +sub run_against_db (;$$$) { + my ($db_name, $quickly, $skip_schema) = @_; + my $checksetup_switches = "--verbose "; + my $failures = 0; + $checksetup_switches .= " --no-templates" if $quickly; + if ($db_name) { + db()->copy_db({ from => $db_name, + to => $test_db_name, + url => $dump_file_url }); + } + # Enable the Voting extension + unlink 'extensions/Voting/disabled'; + $failures += (system("perl -w ./checksetup.pl $answers_file $checksetup_switches") != 0); + # For the sake of consistency, now disable the extension. + system('touch extensions/Voting/disabled'); + # Run tests against the created database only if checksetup ran. + if(!$failures && !$skip_schema) { + print "Validating the created schema...\n"; + check_schema($test_db_name, $db_name); + print "\nRunning tests against the created database...\n"; + $failures += test_created_database(); + } + + return $failures; +} + +our $Test_Die_Count; +# Run a bunch of tests on the DBs. Traps the DIE and WARN handler, and returns +# how many times the DIE handler has to be called. +sub test_created_database () { + require Bugzilla; + require Bugzilla::Bug; + require Bugzilla::User; + require Bugzilla::Series; + require Bugzilla::Attachment; + require Bugzilla::Token; + require Bugzilla::Product; + + # Loading Bugzilla.pm cleared our environment. + set_env(); + + $Test_Die_Count = 0; + + $SIG{__DIE__} = \&test_die; + + # Everything happens in an eval block -- we don't want to ever actually + # die during tests. Things happen in separate eval blocks because we + # want to continue to do the tests even if one of them fails. + + my $rand = db()->sql_random; + + my $dbh; + eval { + # Get a handle to the database. + $dbh = Bugzilla->dbh; + }; + # If we can't create the DB handle, there's no point in the + # rest of the tests. + return $Test_Die_Count if $Test_Die_Count; + + my $test_user; + eval { + # Create a User in the database. + print "Creating a brand-new user..."; + $test_user = Bugzilla::User->create({ + login_name => $test_user_login, + realname => $test_real_name, + cryptpassword => '*'}); + print "inserted $test_user_login\n"; + }; + + # If we can't create the user, most of the rest of our tests will fail anyway. + return $Test_Die_Count if $Test_Die_Count; + + my $bug_id_list; + eval { + # Create some Bug objects. + print "Reading in bug ids... "; + $bug_id_list = $dbh->selectcol_arrayref( + "SELECT bug_id + FROM (SELECT bug_id, $rand AS ord + FROM bugs ORDER BY ord) AS t + LIMIT $object_limit"); + print "found " . scalar(@$bug_id_list) . " bugs.\n"; + + print "Creating bugs"; + foreach my $bug_id (@$bug_id_list) { + print ", $bug_id"; + my $bug = new Bugzilla::Bug($bug_id, $test_user); + # And read in attachment data for each bug, too. + # This also tests a lot of other code paths. + $bug->attachments; + # And call a few other subs for testing purposes. + $bug->dup_id; + $bug->actual_time; + $bug->any_flags_requesteeble; + $bug->blocked; + $bug->cc; + $bug->keywords; + $bug->comments; + $bug->groups; + $bug->choices; + } + print "\n"; + }; + + eval { + # Create some User objects and run some methods on them. + print "Reading in user ids... "; + my $user_id_list = $dbh->selectcol_arrayref( + "SELECT userid + FROM (SELECT userid, $rand AS ord + FROM profiles ORDER BY ord) AS t + LIMIT $object_limit"); + print "found " . scalar(@$user_id_list) . " users.\n"; + + print "Creating users"; + foreach my $user_id (@$user_id_list) { + print ", $user_id"; + my $created_user = new Bugzilla::User($user_id); + $created_user->groups(); + $created_user->queries(); + $created_user->can_see_bug(1) if (@$bug_id_list); + $created_user->get_selectable_products(); + } + print "\n"; + }; + + eval { + # Create some Series objects. + print "Reading in series ids... "; + my $series_id_list = $dbh->selectcol_arrayref( + "SELECT series_id + FROM (SELECT series_id, $rand AS ord + FROM series ORDER BY ord) AS t + LIMIT $object_limit"); + print "found " . scalar(@$series_id_list) . " series.\n"; + print "Creating series"; + foreach my $series_id (@$series_id_list) { + print ", $series_id"; + my $created_series = new Bugzilla::Series($series_id); + # We could have been returned undef if we couldn't see the series. + $created_series->writeToDatabase() if $created_series; + } + print "\n"; + }; + + eval { + # Create some Product objects and their related items. + print "Reading in products... "; + my @products = Bugzilla::Product->get_all; + print "found " . scalar(@products) . " products.\n"; + print "Testing products"; + foreach my $product (@products) { + print ", " . $product->id; + $product->components; + $product->group_controls; + $product->versions; + $product->milestones; + } + print "\n"; + }; + + eval { + # Clean the token table + print "Attempting to clean the Token table... "; + Bugzilla::Token::CleanTokenTable(); + print "cleaned.\n"; + }; + + # Disconnect so that Pg doesn't complain we're still using the DB. + $dbh->disconnect; + Bugzilla->clear_request_cache(); + + return $Test_Die_Count; +} + +# For dealing with certain signals while we're testing. We just +# print out a stack trace and increment our global counter +# of how many times we died. +sub test_die ($) { + my ($message) = @_; + $Test_Die_Count++; + Carp::cluck($message); +} + +##################################################################### +# Read-In Command-Line Arguments +##################################################################### + +# The user can specify versions to test against on the command-line. +my @runversions; +if ($switch{'full'}) { + # The --full switch overrides the version list. + @runversions = (keys %db_list); +} +else { + # All arguments that are not switches are version numbers. + @runversions = @ARGV; + # Skip the basic tests if we were passed-in version numbers. + $switch{'skip-basic'} = $switch{'skip-basic'} || scalar @runversions; +} + +##################################################################### +# Main Code +##################################################################### + +# Basically, what we do is import databases into our current installation +# over and over and see if we can upgrade them with our checksetup. + +our $total_failures = 0; + +# We have to be in the right directory for checksetup to run. +chdir $config->{base_dir} || die "Could not change to the base directory: $!"; + +db()->reset(); + +# Try to run cleanly against the tip database. +print "== Testing against tip database " . $config->{tip_db} . "\n"; +check_test("Test against tip database", + run_against_db($config->{tip_db}, "quickly", "skip schema")); + +# And now copy the database that we created to be our "tip +# database" for schema comparisons in the future. +print "Copying $test_db_name to $tip_database for future schema tests...\n\n"; +db()->copy_db({ from => $test_db_name, + to => $tip_database, + url => $dump_file_url }); + +# If the user specified a specific version to test, don't +# do certain generic tests. +if (!$switch{'skip-basic'}) { + # Have checksetup create an empty DB. + print "== Creating a blank database called $test_db_name\n"; + # We only want to test the chart migration once (because it's slow), so + # let's do it here. + system("cp -r data/mining.bak data/mining"); + db()->drop_db($test_db_name); + check_test("Test of creating an empty database", run_against_db()); + system("rm -rf data/mining"); +} + +# If we're running --full or if we have version numbers, test that stuff. +# But if we failed to do the basic runs, then don't test that stuff. +if (scalar @runversions && !$total_failures) { + # Now run against every version that we have a database for. + foreach my $version (sort @runversions) { + print "== Testing against database from version $version\n"; + check_test("Test against database from version $version", + run_against_db($db_list{$version}, "quickly")); + } +} + +print "\nTest complete. Failed $total_failures time(s).\n"; +exit $total_failures; diff --git a/travis.sh b/travis.sh index f5726f4..4a1bf89 100755 --- a/travis.sh +++ b/travis.sh @@ -6,15 +6,12 @@ # This Source Code Form is "Incompatible With Secondary Licenses", as # defined by the Mozilla Public License, v. 2.0. -QA_REPO="dklawren/qa" -QA_BRANCH="$TRAVIS_BRANCH" - # Setup starts here cd $TRAVIS_BUILD_DIR # Package installation section echo "== Installing OS packages" -sudo apt-get install -y perlmagick apache2 libssl-dev g++ libgd2-xpm-dev xvfb +sudo apt-get install -y curl perlmagick libssl-dev g++ libgd2-xpm-dev libmysqlclient-dev libpq5 postgresql-server-dev-9.1 if [ "$TEST_SUITE" = "docs" ]; then if [ "$TRAVIS_BRANCH" = "master" ]; then @@ -36,17 +33,25 @@ fi echo "== Installing Perl dependencies" cpanm --quiet --notest --reinstall DateTime cpanm --quiet --notest --reinstall Module::Build # Need latest build -cpanm --quiet --notest --reinstall Software::License # Needed by Module::Build +cpanm --quiet --notest --reinstall Software::License # Needed by Module::Build to find proper Mozilla license cpanm --quiet --notest --reinstall Pod::Coverage -cpanm --quiet --notest --reinstall XMLRPC::Lite # Needed for version 4.2 and earlier +cpanm --quiet --notest --reinstall DBD::mysql +cpanm --quiet --notest --reinstall DBD::Pg +cpanm --quiet --notest --reinstall Cache::Memcached::GetParserXS # FIXME test-checksetup.pl fails without this cpanm --quiet --notest --installdeps --with-recommends . +# Link /usr/bin/perl to the current perlbrew perl so that the Bugzilla cgi scripts will work properly +# PERLBREW_ROOT and PERLBREW_PERL are set by the perlbrew binary when switch perl versions +echo "== Fixing Perl" +sudo mv /usr/bin/perl /usr/bin/perl.bak +sudo ln -s $PERLBREW_ROOT/perls/$PERLBREW_PERL/bin/perl /usr/bin/perl + # Basic sanity tests if [ "$TEST_SUITE" = "sanity" ]; then echo "== Running sanity tests" perl Build.PL - ./Build - ./Build test + perl Build + perl Build test exit $? fi @@ -73,6 +78,31 @@ fi echo "== Updating config files" sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place qa/config/selenium_test.conf sed -e "s?%USER%?$USER?g" --in-place qa/config/checksetup_answers.txt +sed -e "s?%USER%?$USER?g" --in-place qa/config/checksetup_upgrade_answers.txt +sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place qa/config/config-checksetup-mysql + +# Create the bugs user for MySQL +if [ "$DB" = "mysql" ]; then + mysql -u root mysql -e "GRANT ALL PRIVILEGES ON *.* TO bugs@localhost IDENTIFIED BY 'bugs'; FLUSH PRIVILEGES;" +fi + +# Create the bugs user for PostgreSQL +if [ "$DB" = "pg" ]; then + sudo -u postgres createuser --superuser bugs + sudo -u postgres psql -U postgres -d postgres -c "alter user bugs with password 'bugs';" +fi + +if [ "$TEST_SUITE" = "checksetup" ] && [ "$DB" = "mysql" ]; then + echo "== Running checksetup tests for MySQL" + perl qa/test-checksetup.pl --full --config config/config-checksetup-mysql + exit $? +fi + +if [ "$TEST_SUITE" = "checksetup" ] && [ "$DB" = "pg" ]; then + echo "== Running checksetup tests for PostgreSQL" + perl qa/test-checksetup.pl --full --config config/config-checksetup-pg + exit $? +fi # Configure Apache to serve from our build directory and restart sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place qa/config/bugzilla.conf @@ -81,15 +111,6 @@ sudo sed -e "s?APACHE_RUN_USER=www-data?APACHE_RUN_USER=$USER?g" --in-place /etc sudo sed -e "s?APACHE_RUN_GROUP=www-data?APACHE_RUN_GROUP=$USER?g" --in-place /etc/apache2/envvars sudo service apache2 stop; sudo rm -rf /var/lock/apache2; sudo service apache2 start -# Link /usr/bin/perl to the current perlbrew perl so that the Bugzilla cgi scripts will work properly -# PERLBREW_ROOT and PERLBREW_PERL are set by the perlbrew binary when switch perl versions -echo "== Fixing Perl" -sudo mv /usr/bin/perl /usr/bin/perl.bak -sudo ln -s $PERLBREW_ROOT/perls/$PERLBREW_PERL/bin/perl /usr/bin/perl - -# We will be using SQLite for our database backend -cpanm --quiet --notest DBD::SQLite - # This is needed for the extended test suite cpanm --quiet --notest Test::WWW::Selenium @@ -98,6 +119,7 @@ perl checksetup.pl qa/config/checksetup_answers.txt perl checksetup.pl qa/config/checksetup_answers.txt # Create test data in the SQLite database for use by the extended test suite +echo "== Generating test data" cd $TRAVIS_BUILD_DIR/qa/config perl -Mlib=$TRAVIS_BUILD_DIR/lib generate_test_data.pl cd $TRAVIS_BUILD_DIR/qa/t @@ -117,7 +139,7 @@ if [ "$TEST_SUITE" = "selenium" ]; then sleep 5 echo "== Running Selenium UI tests" - perl -Mlib=$TRAVIS_BUILD_DIR/lib /usr/bin/prove -v -j4 -I$TRAVIS_BUILD_DIR/lib test_*.t + perl -Mlib=$TRAVIS_BUILD_DIR/lib /usr/bin/prove -v -j2 -I$TRAVIS_BUILD_DIR/lib test_*.t exit $? fi From ce1eedb253a2f026e8b0f26c5a82dbf4204dd294 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 7 May 2014 18:31:00 +0000 Subject: [PATCH 11/25] Bug 983275 - Switch Bugzilla's CI testing from Tinderbox to travis-ci - Added XMLRPC::Lite to the manual installation list --- travis.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/travis.sh b/travis.sh index 4a1bf89..2a596f6 100755 --- a/travis.sh +++ b/travis.sh @@ -38,6 +38,7 @@ cpanm --quiet --notest --reinstall Pod::Coverage cpanm --quiet --notest --reinstall DBD::mysql cpanm --quiet --notest --reinstall DBD::Pg cpanm --quiet --notest --reinstall Cache::Memcached::GetParserXS # FIXME test-checksetup.pl fails without this +cpanm --quiet --notest --reinstall XMLRPC::Lite # Due to the SOAP::Lite split cpanm --quiet --notest --installdeps --with-recommends . # Link /usr/bin/perl to the current perlbrew perl so that the Bugzilla cgi scripts will work properly From af9e27bccd8239f9f1be8813a8742a7eaf48aac8 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Thu, 8 May 2014 20:26:12 +0000 Subject: [PATCH 12/25] Bug 983275 - Switch Bugzilla's CI testing from Tinderbox to travis-ci --- config/checksetup_answers.txt | 4 ++-- config/checksetup_upgrade_answers.txt | 24 ------------------------ travis.sh | 24 ++++++++++++++++++------ 3 files changed, 20 insertions(+), 32 deletions(-) delete mode 100644 config/checksetup_upgrade_answers.txt diff --git a/config/checksetup_answers.txt b/config/checksetup_answers.txt index 4a8be85..9f51ec0 100644 --- a/config/checksetup_answers.txt +++ b/config/checksetup_answers.txt @@ -1,7 +1,7 @@ $answer{'db_host'} = 'localhost'; - $answer{'db_driver'} = 'mysql'; + $answer{'db_driver'} = '%DB%'; $answer{'db_port'} = 0; - $answer{'db_name'} = 'bugs'; + $answer{'db_name'} = '%DB_NAME%', $answer{'db_user'} = 'bugs'; $answer{'db_pass'} = 'bugs'; $answer{'db_sock'} = ''; diff --git a/config/checksetup_upgrade_answers.txt b/config/checksetup_upgrade_answers.txt deleted file mode 100644 index fb78b06..0000000 --- a/config/checksetup_upgrade_answers.txt +++ /dev/null @@ -1,24 +0,0 @@ - $answer{'db_host'} = 'localhost'; - $answer{'db_driver'} = 'mysql'; - $answer{'db_port'} = 0; - $answer{'db_name'} = 'bugs_checksetup'; - $answer{'db_user'} = 'bugs'; - $answer{'db_pass'} = 'bugs'; - $answer{'db_sock'} = ''; - $answer{'db_check'} = 1; - $answer{'db_mysql_ssl_ca_file'} = ''; - $answer{'db_mysql_ssl_ca_path'} = ''; - $answer{'db_mysql_ssl_client_cert'} = ''; - $answer{'db_mysql_ssl_client_key'} = ''; - $answer{'urlbase'} = 'http://localhost/bugzilla/'; - $answer{'create_htaccess'} = ''; - $answer{'use_suexec'} = ''; - $answer{'index_html'} = 0; - $answer{'cvsbin'} = '/usr/bin/cvs'; - $answer{'interdiffbin'} = '/usr/bin/interdiff'; - $answer{'diffpath'} = '/usr/bin'; - $answer{'webservergroup'} = '%USER%'; - $answer{'ADMIN_EMAIL'} = 'admin@my.company'; - $answer{'ADMIN_PASSWORD'} = '******'; - $answer{'ADMIN_REALNAME'} = 'admin'; - $answer{'NO_PAUSE'} = 1; diff --git a/travis.sh b/travis.sh index 2a596f6..173a552 100755 --- a/travis.sh +++ b/travis.sh @@ -79,33 +79,43 @@ fi echo "== Updating config files" sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place qa/config/selenium_test.conf sed -e "s?%USER%?$USER?g" --in-place qa/config/checksetup_answers.txt -sed -e "s?%USER%?$USER?g" --in-place qa/config/checksetup_upgrade_answers.txt -sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place qa/config/config-checksetup-mysql +if [ "$DB" = "" ]; then + DB=mysql +fi +sed -e "s?%DB%?$DB?g" --in-place qa/config/checksetup_answers.txt -# Create the bugs user for MySQL +# MySQL related setup if [ "$DB" = "mysql" ]; then + echo "== Setting up MySQL" mysql -u root mysql -e "GRANT ALL PRIVILEGES ON *.* TO bugs@localhost IDENTIFIED BY 'bugs'; FLUSH PRIVILEGES;" fi -# Create the bugs user for PostgreSQL +# PostgreSQL related setup if [ "$DB" = "pg" ]; then + echo "== Setting up PostgreSQL" sudo -u postgres createuser --superuser bugs sudo -u postgres psql -U postgres -d postgres -c "alter user bugs with password 'bugs';" fi +# Checksetup test which tests schema changes from older versions to the current if [ "$TEST_SUITE" = "checksetup" ] && [ "$DB" = "mysql" ]; then - echo "== Running checksetup tests for MySQL" + echo "== Running checksetup upgrade tests for MySQL" + sed -e "s?%DB_NAME%?bugs_checksetup?g" --in-place qa/config/checksetup_answers.txt + sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place qa/config/config-checksetup-mysql perl qa/test-checksetup.pl --full --config config/config-checksetup-mysql exit $? fi if [ "$TEST_SUITE" = "checksetup" ] && [ "$DB" = "pg" ]; then - echo "== Running checksetup tests for PostgreSQL" + echo "== Running checksetup upgrade tests for PostgreSQL" + sed -e "s?%DB_NAME%?bugs_checksetup?g" --in-place qa/config/checksetup_answers.txt + sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place qa/config/config-checksetup-pg perl qa/test-checksetup.pl --full --config config/config-checksetup-pg exit $? fi # Configure Apache to serve from our build directory and restart +echo "== Setting up Apache" sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place qa/config/bugzilla.conf sudo cp qa/config/bugzilla.conf /etc/apache2/sites-available/default sudo sed -e "s?APACHE_RUN_USER=www-data?APACHE_RUN_USER=$USER?g" --in-place /etc/apache2/envvars @@ -116,6 +126,8 @@ sudo service apache2 stop; sudo rm -rf /var/lock/apache2; sudo service apache2 s cpanm --quiet --notest Test::WWW::Selenium # We have to run checksetup.pl twice as the first run creates localconfig +echo "== Running checksetup" +sed -e "s?%DB_NAME%?bugs?g" --in-place qa/config/checksetup_answers.txt perl checksetup.pl qa/config/checksetup_answers.txt perl checksetup.pl qa/config/checksetup_answers.txt From e3e6b2eb566f495bb34ed71dc0e1e7c5fad59c2d Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Fri, 9 May 2014 18:29:54 +0000 Subject: [PATCH 13/25] Changed operator for cmp_ok from = to == --- t/webservice_bug_search.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/webservice_bug_search.t b/t/webservice_bug_search.t index f1ca324..ffd771b 100644 --- a/t/webservice_bug_search.t +++ b/t/webservice_bug_search.t @@ -140,7 +140,7 @@ sub post_success { my $expected_count = $t->{bugs}; $expected_count = 1 if !defined $expected_count; if ($expected_count) { - my $operator = $t->{exactly} ? '=' : '>='; + my $operator = $t->{exactly} ? '==' : '>='; cmp_ok(scalar @$bugs, $operator, $expected_count, 'The right number of bugs are returned'); unless ($t->{user} and $t->{user} eq PRIVATE_BUG_USER) { From 570ad6b248620512f3f6a538e377d7e3da9f6735 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Mon, 12 May 2014 21:29:32 +0000 Subject: [PATCH 14/25] Bug 983275 - Switch Bugzilla's CI testing from Tinderbox to travis-ci - Fix broken config option for test-checksetup.pl --- config/config-checksetup-mysql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config-checksetup-mysql b/config/config-checksetup-mysql index 53a9f3f..a0b5b31 100755 --- a/config/config-checksetup-mysql +++ b/config/config-checksetup-mysql @@ -8,7 +8,7 @@ use constant CONFIG => { db_type => 'MySQL', db_user => 'bugs', db_pass => 'bugs', - answers => 'qa/config/checksetup_upgrade_answers.txt', + answers => 'qa/config/checksetup_answers.txt', test_user_login => 'checksetup_test_user@my.company', test_real_name => 'Checksetup Test User', dump_file_url => 'https://people.mozilla.org/~dkl/tinderbox/dumps/mysql', From f922274e82deb0d62889a7c469b3c62d47e20963 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Tue, 13 May 2014 00:53:04 -0400 Subject: [PATCH 15/25] Bug 983275 - Switch Bugzilla's CI testing from Tinderbox to travis-ci --- travis.sh | 80 +++++++++++++++++++++++-------------------------------- 1 file changed, 34 insertions(+), 46 deletions(-) diff --git a/travis.sh b/travis.sh index 173a552..7185b6b 100755 --- a/travis.sh +++ b/travis.sh @@ -9,37 +9,37 @@ # Setup starts here cd $TRAVIS_BUILD_DIR +# Allow alias expansion inside shell scripts +shopt -s expand_aliases + # Package installation section +echo -en 'travis_fold:start:packages\r' echo "== Installing OS packages" -sudo apt-get install -y curl perlmagick libssl-dev g++ libgd2-xpm-dev libmysqlclient-dev libpq5 postgresql-server-dev-9.1 - -if [ "$TEST_SUITE" = "docs" ]; then - if [ "$TRAVIS_BRANCH" = "master" ]; then - sudo apt-get install -y python-sphinx - elif [ "$TRAVIS_BRANCH" = "4.4" ]; then - sudo apt-get install -y xmlto lynx texlive-lang-cyrillic - else - sudo apt-get install -y ldp-docbook-dsssl jade jadetex lynx - export JADE_PUB=/usr/share/sgml/declaration - export LDP_HOME=/usr/share/sgml/docbook/stylesheet/dsssl/ldp - fi -fi +sudo apt-get install -qq -y \ + perlmagick libssl-dev g++ libgd2-xpm-dev libmysqlclient-dev libpq5 \ + postgresql-server-dev-9.1 python-sphinx xmlto lynx texlive-lang-cyrillic \ + ldp-docbook-dsssl jade jadetex lynx apache2 xvfb +echo -en 'travis_fold:end:packages\r' -if [ "$TEST_SUITE" = "selenium" ] || [ "$TEST_SUITE" = "webservices" ]; then - sudo apt-get install -y apache2 xvfb -fi +# Environment need for docs building +export JADE_PUB=/usr/share/sgml/declaration +export LDP_HOME=/usr/share/sgml/docbook/stylesheet/dsssl/ldp # Install dependencies from Build.PL +echo -en 'travis_fold:start:perl_dependencies\r' echo "== Installing Perl dependencies" -cpanm --quiet --notest --reinstall DateTime -cpanm --quiet --notest --reinstall Module::Build # Need latest build -cpanm --quiet --notest --reinstall Software::License # Needed by Module::Build to find proper Mozilla license -cpanm --quiet --notest --reinstall Pod::Coverage -cpanm --quiet --notest --reinstall DBD::mysql -cpanm --quiet --notest --reinstall DBD::Pg -cpanm --quiet --notest --reinstall Cache::Memcached::GetParserXS # FIXME test-checksetup.pl fails without this -cpanm --quiet --notest --reinstall XMLRPC::Lite # Due to the SOAP::Lite split -cpanm --quiet --notest --installdeps --with-recommends . +alias cpanm='cpanm --quiet --notest --reinstall' +cpanm DateTime +cpanm Module::Build # Need latest build +cpanm Software::License # Needed by Module::Build to find proper Mozilla license +cpanm Pod::Coverage +cpanm DBD::mysql +cpanm DBD::Pg +cpanm Cache::Memcached::GetParserXS # FIXME test-checksetup.pl fails without this +cpanm XMLRPC::Lite # Due to the SOAP::Lite split +cpanm Test::WWW::Selenium # For webservice and selenium tests +cpanm --installdeps --with-recommends . # Install dependencies reported by Build.PL +echo -en 'travis_fold:end:perl_dependencies\r' # Link /usr/bin/perl to the current perlbrew perl so that the Bugzilla cgi scripts will work properly # PERLBREW_ROOT and PERLBREW_PERL are set by the perlbrew binary when switch perl versions @@ -64,17 +64,6 @@ if [ "$TEST_SUITE" = "docs" ]; then exit $? fi -# Switch to the correct branch for the QA repo -if [ "$TRAVIS_BRANCH" != "master" ]; then - echo "== Switch to the proper $TRAVIS_BRANCH QA branch for extended tests" - cd $TRAVIS_BUILD_DIR/qa - git checkout $TRAVIS_BRANCH - if [ ! -f config/selenium_test.conf ]; then - exit 1 - fi - cd $TRAVIS_BUILD_DIR -fi - # We need to replace some variables in the config files from the Travis CI environment echo "== Updating config files" sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place qa/config/selenium_test.conf @@ -83,6 +72,13 @@ if [ "$DB" = "" ]; then DB=mysql fi sed -e "s?%DB%?$DB?g" --in-place qa/config/checksetup_answers.txt +sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place qa/config/config-checksetup-mysql +sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place qa/config/config-checksetup-pg +if [ "$TEST_SUITE" == "checksetup" ]; then + sed -e "s?%DB_NAME%?bugs_checksetup?g" --in-place qa/config/checksetup_answers.txt +else + sed -e "s?%DB_NAME%?bugs?g" --in-place qa/config/checksetup_answers.txt +fi # MySQL related setup if [ "$DB" = "mysql" ]; then @@ -100,16 +96,12 @@ fi # Checksetup test which tests schema changes from older versions to the current if [ "$TEST_SUITE" = "checksetup" ] && [ "$DB" = "mysql" ]; then echo "== Running checksetup upgrade tests for MySQL" - sed -e "s?%DB_NAME%?bugs_checksetup?g" --in-place qa/config/checksetup_answers.txt - sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place qa/config/config-checksetup-mysql perl qa/test-checksetup.pl --full --config config/config-checksetup-mysql exit $? fi if [ "$TEST_SUITE" = "checksetup" ] && [ "$DB" = "pg" ]; then echo "== Running checksetup upgrade tests for PostgreSQL" - sed -e "s?%DB_NAME%?bugs_checksetup?g" --in-place qa/config/checksetup_answers.txt - sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place qa/config/config-checksetup-pg perl qa/test-checksetup.pl --full --config config/config-checksetup-pg exit $? fi @@ -122,12 +114,8 @@ sudo sed -e "s?APACHE_RUN_USER=www-data?APACHE_RUN_USER=$USER?g" --in-place /etc sudo sed -e "s?APACHE_RUN_GROUP=www-data?APACHE_RUN_GROUP=$USER?g" --in-place /etc/apache2/envvars sudo service apache2 stop; sudo rm -rf /var/lock/apache2; sudo service apache2 start -# This is needed for the extended test suite -cpanm --quiet --notest Test::WWW::Selenium - # We have to run checksetup.pl twice as the first run creates localconfig echo "== Running checksetup" -sed -e "s?%DB_NAME%?bugs?g" --in-place qa/config/checksetup_answers.txt perl checksetup.pl qa/config/checksetup_answers.txt perl checksetup.pl qa/config/checksetup_answers.txt @@ -152,14 +140,14 @@ if [ "$TEST_SUITE" = "selenium" ]; then sleep 5 echo "== Running Selenium UI tests" - perl -Mlib=$TRAVIS_BUILD_DIR/lib /usr/bin/prove -v -j2 -I$TRAVIS_BUILD_DIR/lib test_*.t + perl -Mlib=$TRAVIS_BUILD_DIR/lib /usr/bin/prove -v -f -I$TRAVIS_BUILD_DIR/lib test_*.t exit $? fi # WebService Tests if [ "$TEST_SUITE" = "webservices" ]; then echo "== Running WebService tests" - perl -Mlib=$TRAVIS_BUILD_DIR/lib /usr/bin/prove -v -I$TRAVIS_BUILD_DIR/lib webservice_*.t + perl -Mlib=$TRAVIS_BUILD_DIR/lib /usr/bin/prove -v -f -I$TRAVIS_BUILD_DIR/lib webservice_*.t exit $? fi From 16312cf08f1472489dd69ac72819bdeac30aa6ad Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 14 May 2014 15:20:46 -0400 Subject: [PATCH 16/25] Bug 983275 - Switch Bugzilla's CI testing from Tinderbox to travis-ci --- config/checksetup_answers.txt | 9 +++++---- config/patch.diff | 18 ++++++++++++++++++ test-checksetup.pl | 2 -- travis.sh | 10 +++++++--- 4 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 config/patch.diff diff --git a/config/checksetup_answers.txt b/config/checksetup_answers.txt index 9f51ec0..1957798 100644 --- a/config/checksetup_answers.txt +++ b/config/checksetup_answers.txt @@ -18,7 +18,8 @@ $answer{'interdiffbin'} = '/usr/bin/interdiff'; $answer{'diffpath'} = '/usr/bin'; $answer{'webservergroup'} = '%USER%'; - $answer{'ADMIN_EMAIL'} = 'admin@my.company'; - $answer{'ADMIN_PASSWORD'} = '******'; - $answer{'ADMIN_REALNAME'} = 'admin'; - $answer{'NO_PAUSE'} = 1; + $answer{'ADMIN_OK'} = 'Y'; + $answer{'ADMIN_EMAIL'} = 'admin@bugzilla.org'; + $answer{'ADMIN_PASSWORD'} = 'password'; + $answer{'ADMIN_REALNAME'} = 'QA Admin'; + $answer{'NO_PAUSE'} = 1; diff --git a/config/patch.diff b/config/patch.diff new file mode 100644 index 0000000..6526071 --- /dev/null +++ b/config/patch.diff @@ -0,0 +1,18 @@ +Index: Bugzilla/Config/MTA.pm +=================================================================== +RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Config/MTA.pm,v +retrieving revision 1.13 +diff -3 -p -u -r1.13 MTA.pm +--- Bugzilla/Config/MTA.pm 13 Nov 2006 23:32:28 -0000 1.13 ++++ Bugzilla/Config/MTA.pm 9 Dec 2006 12:19:44 -0000 +@@ -44,7 +44,9 @@ sub get_param_list { + { + name => 'mail_delivery_method', + type => 's', +- choices => [Email::Send->new()->all_mailers(), 'None'], ++ # Bugzilla is not ready yet to send mails to newsgroups, and 'IO' ++ # is of no use for now as we already have our own 'Test' mode. ++ choices => [grep {$_ ne 'NNTP' && $_ ne 'IO'} Email::Send->new()->all_mailers(), 'None'], + default => 'Sendmail', + checker => \&check_mail_delivery_method + }, diff --git a/test-checksetup.pl b/test-checksetup.pl index 83badf9..a36b175 100755 --- a/test-checksetup.pl +++ b/test-checksetup.pl @@ -326,10 +326,8 @@ ($) print "== Creating a blank database called $test_db_name\n"; # We only want to test the chart migration once (because it's slow), so # let's do it here. - system("cp -r data/mining.bak data/mining"); db()->drop_db($test_db_name); check_test("Test of creating an empty database", run_against_db()); - system("rm -rf data/mining"); } # If we're running --full or if we have version numbers, test that stuff. diff --git a/travis.sh b/travis.sh index 7185b6b..dc238b9 100755 --- a/travis.sh +++ b/travis.sh @@ -119,6 +119,10 @@ echo "== Running checksetup" perl checksetup.pl qa/config/checksetup_answers.txt perl checksetup.pl qa/config/checksetup_answers.txt +# Add patch file used by tests. FIXME: make this a config option +sudo mkdir -p /var/www/html/selenium/bugzilla +sudo cp qa/config/patch.diff /var/www/html/selenium/bugzilla + # Create test data in the SQLite database for use by the extended test suite echo "== Generating test data" cd $TRAVIS_BUILD_DIR/qa/config @@ -130,14 +134,14 @@ if [ "$TEST_SUITE" = "selenium" ]; then # Start the virtual frame buffer echo "== Starting virtual frame buffer" export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start + sudo sh -e /etc/init.d/xvfb start sleep 5 # Download and start the selenium server echo "== Downloading and starting Selenium server" wget http://selenium-release.storage.googleapis.com/2.41/selenium-server-standalone-2.41.0.jar - sudo java -jar selenium-server-standalone-2.41.0.jar 1> /dev/null & - sleep 5 + java -jar selenium-server-standalone-2.41.0.jar -DfirefoxDefaultPath=/usr/lib64/firefox/firefox -log ~/sel-`date +%Y%m%d-%H%M%S`.log & + sleep 15 echo "== Running Selenium UI tests" perl -Mlib=$TRAVIS_BUILD_DIR/lib /usr/bin/prove -v -f -I$TRAVIS_BUILD_DIR/lib test_*.t From b464bebc74ffae0f46d58370ef8cbe1506e2d2f6 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 14 May 2014 15:30:37 -0400 Subject: [PATCH 17/25] Bug 983275 - Switch Bugzilla's CI testing from Tinderbox to travis-ci --- config/config-checksetup-pg | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 config/config-checksetup-pg diff --git a/config/config-checksetup-pg b/config/config-checksetup-pg new file mode 100755 index 0000000..30baa48 --- /dev/null +++ b/config/config-checksetup-pg @@ -0,0 +1,38 @@ +use strict; +use warnings; + +use constant CONFIG => { + base_dir => '%TRAVIS_BUILD_DIR%', + test_db => 'bugs_checksetup', + tip_db => 'bugs_tip', + db_type => 'Pg', + db_user => 'bugs', + db_pass => 'bugs', + answers => '/home/tinderbox/answers', + answers => 'qa/config/checksetup_answers.txt', + test_user_login => 'checksetup_test_user@my.company', + test_real_name => 'Checksetup Test User', + dump_file_url => 'https://people.mozilla.org/~dkl/tinderbox/dumps/pg', + db_list => { + '2.20.x' => 'bugs_bugzilla2_20_branch', + '2.22.x' => 'bugs_bugzilla2_22_branch', + '2.23.2' => 'bugs_2_23_2', + '2.23.4' => 'bugs_2_23_4', + '3.0' => 'bugs_3_0', + '3.1.1' => 'bugs_3_1_1', + '3.1.3' => 'bugs_3_1_3', + '3.1.4' => 'bugs_3_1_4', + '3.2rc1' => 'bugs_3_2rc1', + '3.3.1' => 'bugs_3_3_1', + '3.3.4' => 'bugs_3_3_4', + '3.5.1' => 'bugs_3_5_1', + '3.5.3' => 'bugs_3_5_3', + '3.7.1' => 'bugs_3_7_1', + '3.7.2' => 'bugs_3_7_2', + '4.1.1' => 'bugs_4_1_1', + '4.1.3' => 'bugs_4_1_3', + '4.2rc1' => 'bugs_4_2rc1', + }, +}; + +1; From d467c240861e38fe95b20f637efbc6b7faf76e9e Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Fri, 16 May 2014 16:46:34 +0000 Subject: [PATCH 18/25] Bug 1011147 - Move patch file path to a config variable in the selenium_test.conf file --- config/selenium_test.conf | 1 + t/test_flags.t | 8 ++++---- t/test_flags2.t | 2 +- t/test_private_attachments.t | 6 +++--- t/test_security.t | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/config/selenium_test.conf b/config/selenium_test.conf index 17857da..8d1b8ad 100644 --- a/config/selenium_test.conf +++ b/config/selenium_test.conf @@ -9,6 +9,7 @@ 'host' => 'localhost', 'port' => 4444, 'browser_url' => 'http://localhost', + 'attachment_file' => '%TRAVIS_BUILD_DIR%/qa/config/patch.diff', 'bugzilla_installation' => 'bugzilla', 'bugzilla_path' => '%TRAVIS_BUILD_DIR%', 'admin_user_login' => 'admin@my.company', diff --git a/t/test_flags.t b/t/test_flags.t index 384b50a..b591654 100644 --- a/t/test_flags.t +++ b/t/test_flags.t @@ -267,7 +267,7 @@ edit_bug_and_return($sel, $bug1_id, $bug_summary); $sel->click_ok("link=Add an attachment"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create New Attachment for Bug #$bug1_id"); -$sel->type_ok("data", "/var/www/html/selenium/bugzilla/patch.diff"); +$sel->type_ok("data", $config->{attachment_file}); $sel->type_ok("description", "patch, v1"); $sel->check_ok("ispatch"); $sel->is_text_present_ok("SeleniumAttachmentFlag1Test"); @@ -292,7 +292,7 @@ my $attachment1_id = $1; $sel->click_ok("//a[contains(text(),'Create\n Another Attachment to Bug $bug1_id')]"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create New Attachment for Bug #$bug1_id"); -$sel->type_ok("data", "/var/www/html/selenium/bugzilla/patch.diff"); +$sel->type_ok("data", $config->{attachment_file}); $sel->type_ok("description", "patch, v2"); $sel->check_ok("ispatch"); # Mark the previous attachment as obsolete. @@ -314,7 +314,7 @@ my $attachment2_id = $1; $sel->click_ok("//a[contains(text(),'Create\n Another Attachment to Bug $bug1_id')]"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create New Attachment for Bug #$bug1_id"); -$sel->type_ok("data", "/var/www/html/selenium/bugzilla/patch.diff"); +$sel->type_ok("data", $config->{attachment_file}); $sel->type_ok("description", "patch, v3"); $sel->click_ok("list"); $sel->select_ok("contenttypeselection", "label=plain text (text/plain)"); @@ -378,7 +378,7 @@ $sel->title_like(qr/^Bug $bug1_id/); $sel->click_ok("link=Add an attachment"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create New Attachment for Bug #$bug1_id"); -$sel->type_ok("data", "/var/www/html/selenium/bugzilla/patch.diff"); +$sel->type_ok("data", $config->{attachment_file}); $sel->type_ok("description", "patch, v4"); $sel->value_is("ispatch", "off"); $sel->value_is("autodetect", "on"); diff --git a/t/test_flags2.t b/t/test_flags2.t index d6b6e67..19f43ad 100644 --- a/t/test_flags2.t +++ b/t/test_flags2.t @@ -143,7 +143,7 @@ my $bug_summary = "The selenium flag should be kept on product change"; $sel->type_ok("short_desc", $bug_summary); $sel->type_ok("comment", "pom"); $sel->click_ok('//input[@value="Add an attachment"]'); -$sel->type_ok("data", "/var/www/html/selenium/bugzilla/patch.diff"); +$sel->type_ok("data", $config->{attachment_file}); $sel->type_ok("description", "small patch"); $sel->click_ok("ispatch"); $sel->value_is("ispatch", "on"); diff --git a/t/test_private_attachments.t b/t/test_private_attachments.t index 79bd91c..8901f2a 100644 --- a/t/test_private_attachments.t +++ b/t/test_private_attachments.t @@ -27,7 +27,7 @@ $sel->type_ok("short_desc", $bug_summary); $sel->type_ok("comment", "and some attachments too, like this one."); $sel->check_ok("comment_is_private"); $sel->click_ok('//input[@value="Add an attachment"]'); -$sel->type_ok("data", "/var/www/html/selenium/bugzilla/patch.diff"); +$sel->type_ok("data", $config->{attachment_file}); $sel->type_ok("description", "private attachment, v1"); $sel->check_ok("ispatch"); my $bug1_id = create_bug($sel, $bug_summary); @@ -40,7 +40,7 @@ $sel->is_checked_ok('//a[@id="comment_link_0"]/../..//div//input[@type="checkbox $sel->click_ok("link=Add an attachment"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create New Attachment for Bug #$bug1_id"); -$sel->type_ok("data", "/var/www/html/selenium/bugzilla/patch.diff"); +$sel->type_ok("data", $config->{attachment_file}); $sel->type_ok("description", "public attachment, v2"); $sel->check_ok("ispatch"); # The existing attachment name must be displayed, to mark it as obsolete. @@ -87,7 +87,7 @@ $sel->is_text_present_ok("This attachment is not mine"); $sel->click_ok("link=Add an attachment"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create New Attachment for Bug #$bug1_id"); -$sel->type_ok("data", "/var/www/html/selenium/bugzilla/patch.diff"); +$sel->type_ok("data", $config->{attachment_file}); $sel->check_ok("ispatch"); # The user doesn't have editbugs privs. $sel->is_text_present_ok("[no attachments can be made obsolete]"); diff --git a/t/test_security.t b/t/test_security.t index 76cde80..b0cd84f 100644 --- a/t/test_security.t +++ b/t/test_security.t @@ -17,7 +17,7 @@ file_bug_in_product($sel, "TestProduct"); my $bug_summary = "Security checks"; $sel->type_ok("short_desc", $bug_summary); $sel->type_ok("comment", "This bug will be used to test security fixes."); -$sel->type_ok("data", "/var/www/html/selenium/bugzilla/patch.diff"); +$sel->type_ok("data", $config->{attachment_file}); $sel->type_ok("description", "simple patch, v1"); $sel->click_ok("ispatch"); my $bug1_id = create_bug($sel, $bug_summary); From 16b8b5b731b578abffb62869ce7deacfd3162aac Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Fri, 25 Jul 2014 12:11:37 -0400 Subject: [PATCH 19/25] Fixed apt-get errors on Travis CI for recent failures --- travis.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/travis.sh b/travis.sh index dc238b9..50b12cc 100755 --- a/travis.sh +++ b/travis.sh @@ -15,6 +15,7 @@ shopt -s expand_aliases # Package installation section echo -en 'travis_fold:start:packages\r' echo "== Installing OS packages" +sudo apt-get update -qq -y --fix-missing sudo apt-get install -qq -y \ perlmagick libssl-dev g++ libgd2-xpm-dev libmysqlclient-dev libpq5 \ postgresql-server-dev-9.1 python-sphinx xmlto lynx texlive-lang-cyrillic \ From 9c8153cc9fef5c9b8092a0b5c3bea2244dd4340f Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 6 Aug 2014 21:36:22 +0000 Subject: [PATCH 20/25] Bug 1049656 - webservice_jsonp.t is failing in the automated webservice tests due to recent JSONP changes for a security vulnerability --- t/lib/QA/RPC/JSONRPC.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/lib/QA/RPC/JSONRPC.pm b/t/lib/QA/RPC/JSONRPC.pm index 2483ec6..212210a 100644 --- a/t/lib/QA/RPC/JSONRPC.pm +++ b/t/lib/QA/RPC/JSONRPC.pm @@ -101,7 +101,7 @@ sub _get { my $callback = $self->_bz_callback; if (defined $callback and $result->is_success) { my $content = $result->content; - $content =~ s/^\Q$callback(\E(.*)\)$/$1/s; + $content =~ s/^(?:\/\*\*\/)?\Q$callback(\E(.*)\)$/$1/s; $result->content($content); # We don't need this anymore, and we don't want it to affect # future calls. From 181dbd0f75abcfb514d7290784448273f83accf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Buclin?= Date: Sun, 21 Dec 2014 23:27:52 +0100 Subject: [PATCH 21/25] bz_create_test_bugs() no longer takes a $config argument --- t/webservice_bug_add_attachment.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/webservice_bug_add_attachment.t b/t/webservice_bug_add_attachment.t index 55ab818..9df83c0 100644 --- a/t/webservice_bug_add_attachment.t +++ b/t/webservice_bug_add_attachment.t @@ -34,7 +34,7 @@ sub attach { } my ($public_bug, $private_bug) = - $xmlrpc->bz_create_test_bugs($config, 'private'); + $xmlrpc->bz_create_test_bugs('private'); my $public_id = $public_bug->{id}; my $private_id = $private_bug->{id}; From 8ca504859ac3d25c6345aa54f2feace0aafdf00c Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 4 Feb 2015 15:19:16 -0500 Subject: [PATCH 22/25] Changes to travis.sh to decrease the amount of time needed for testing depending on which test path is taken --- travis.sh | 103 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 71 insertions(+), 32 deletions(-) diff --git a/travis.sh b/travis.sh index 50b12cc..4006d1f 100755 --- a/travis.sh +++ b/travis.sh @@ -12,33 +12,89 @@ cd $TRAVIS_BUILD_DIR # Allow alias expansion inside shell scripts shopt -s expand_aliases +alias cpanm='cpanm --quiet --notest --reinstall' + +# Basic sanity tests +if [ "$TEST_SUITE" = "sanity" ]; then + echo -en 'travis_fold:start:perl_dependencies\r' + echo "== Installing Perl dependencies"a + cpanm Authen::Radius + cpanm DBI + cpanm Daemon::Generic + cpanm Date::Format + cpanm DateTime::TimeZone + cpanm Email::Address + cpanm Email::MIME + cpanm Email::Reply + cpanm Email::Sender::Simple + cpanm File::Slurp + cpanm JSON::RPC + cpanm JSON::XS + cpanm LWP::UserAgent + cpanm Math::Random::ISAAC + cpanm Net::LDAP + cpanm PatchReader + cpanm Pod::Coverage + cpanm Template + cpanm Test::Taint + cpanm Text::Markdown + cpanm TheSchwartz + cpanm URI + cpanm XMLRPC::Lite + echo -en 'travis_fold:end:perl_dependencies\r' + + echo "== Running sanity tests" + prove -v -f t/*.t + exit $? +fi + +echo "== Updating OS packages" +sudo apt-get update -qq -y --fix-missing + +# Documentation build testing +if [ "$TEST_SUITE" = "docs" ]; then + echo -en 'travis_fold:start:packages\r' + echo "== Installing OS packages" + sudo apt-get install -qq -y python-sphinx xmlto lynx texlive-lang-cyrillic \ + ldp-docbook-dsssl jade jadetex + echo -en 'travis_fold:end:packages\r' + + # Environment need for docs building + export JADE_PUB=/usr/share/sgml/declaration + export LDP_HOME=/usr/share/sgml/docbook/stylesheet/dsssl/ldp + + echo "== Running documentation build" + cd docs + perl makedocs.pl --with-pdf + exit $? +fi + # Package installation section +EXTRA_PKGS="" +if [ "$DB" = "pg" ]; then + EXTRA_PKGS="postgresql-server-dev-9.3" +fi +if [ "$DB" = "mysql" ]; then + EXTRA_PKGS="libmysqlclient-dev" +fi + echo -en 'travis_fold:start:packages\r' echo "== Installing OS packages" -sudo apt-get update -qq -y --fix-missing -sudo apt-get install -qq -y \ - perlmagick libssl-dev g++ libgd2-xpm-dev libmysqlclient-dev libpq5 \ - postgresql-server-dev-9.1 python-sphinx xmlto lynx texlive-lang-cyrillic \ - ldp-docbook-dsssl jade jadetex lynx apache2 xvfb +sudo apt-get install -qq -y perlmagick libssl-dev g++ libgd2-xpm-dev libpq5 \ + apache2 xvfb $EXTRA_PKGS echo -en 'travis_fold:end:packages\r' -# Environment need for docs building -export JADE_PUB=/usr/share/sgml/declaration -export LDP_HOME=/usr/share/sgml/docbook/stylesheet/dsssl/ldp - # Install dependencies from Build.PL echo -en 'travis_fold:start:perl_dependencies\r' echo "== Installing Perl dependencies" -alias cpanm='cpanm --quiet --notest --reinstall' +cpanm Cache::Memcached::GetParserXS # FIXME test-checksetup.pl fails without this cpanm DateTime -cpanm Module::Build # Need latest build -cpanm Software::License # Needed by Module::Build to find proper Mozilla license -cpanm Pod::Coverage cpanm DBD::mysql cpanm DBD::Pg -cpanm Cache::Memcached::GetParserXS # FIXME test-checksetup.pl fails without this -cpanm XMLRPC::Lite # Due to the SOAP::Lite split +cpanm Module::Build # Need latest build +cpanm Software::License # Needed by Module::Build to find proper Mozilla license cpanm Test::WWW::Selenium # For webservice and selenium tests +cpanm XMLRPC::Lite # Due to the SOAP::Lite split cpanm --installdeps --with-recommends . # Install dependencies reported by Build.PL echo -en 'travis_fold:end:perl_dependencies\r' @@ -48,23 +104,6 @@ echo "== Fixing Perl" sudo mv /usr/bin/perl /usr/bin/perl.bak sudo ln -s $PERLBREW_ROOT/perls/$PERLBREW_PERL/bin/perl /usr/bin/perl -# Basic sanity tests -if [ "$TEST_SUITE" = "sanity" ]; then - echo "== Running sanity tests" - perl Build.PL - perl Build - perl Build test - exit $? -fi - -# Documentation build testing -if [ "$TEST_SUITE" = "docs" ]; then - echo "== Running documentation build" - cd docs - perl makedocs.pl --with-pdf - exit $? -fi - # We need to replace some variables in the config files from the Travis CI environment echo "== Updating config files" sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place qa/config/selenium_test.conf From 7a9929c47070836b7818bc0b48724cc1e95dfaee Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Mon, 16 Feb 2015 09:28:56 -0500 Subject: [PATCH 23/25] Added Emai::Send to sanity perl dependencies --- travis.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/travis.sh b/travis.sh index 4006d1f..086af9b 100755 --- a/travis.sh +++ b/travis.sh @@ -26,6 +26,7 @@ if [ "$TEST_SUITE" = "sanity" ]; then cpanm Email::Address cpanm Email::MIME cpanm Email::Reply + cpanm Email::Send cpanm Email::Sender::Simple cpanm File::Slurp cpanm JSON::RPC From 214eb3a34c1effd34e9cf8a1f0526a323bcabd9e Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Mon, 16 Feb 2015 21:05:11 -0500 Subject: [PATCH 24/25] - Move DB specific configuration to travis.yml file --- travis.sh | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/travis.sh b/travis.sh index 086af9b..66499db 100755 --- a/travis.sh +++ b/travis.sh @@ -73,10 +73,10 @@ fi # Package installation section EXTRA_PKGS="" if [ "$DB" = "pg" ]; then - EXTRA_PKGS="postgresql-server-dev-9.3" + EXTRA_PKGS="postgresql-server-dev-9.1" fi if [ "$DB" = "mysql" ]; then - EXTRA_PKGS="libmysqlclient-dev" + EXTRA_PKGS="libmysqlclient-dev" fi echo -en 'travis_fold:start:packages\r' @@ -88,10 +88,14 @@ echo -en 'travis_fold:end:packages\r' # Install dependencies from Build.PL echo -en 'travis_fold:start:perl_dependencies\r' echo "== Installing Perl dependencies" -cpanm Cache::Memcached::GetParserXS # FIXME test-checksetup.pl fails without this cpanm DateTime -cpanm DBD::mysql -cpanm DBD::Pg +if [ "$DB" = "pg" ]; then + cpanm DBD::Pg +fi +if [ "$DB" = "mysql" ]; then + cpanm DBD::mysql +fi +cpanm Cache::Memcached::GetParserXS # FIXME test-checksetup.pl fails without this cpanm Module::Build # Need latest build cpanm Software::License # Needed by Module::Build to find proper Mozilla license cpanm Test::WWW::Selenium # For webservice and selenium tests @@ -121,19 +125,6 @@ else sed -e "s?%DB_NAME%?bugs?g" --in-place qa/config/checksetup_answers.txt fi -# MySQL related setup -if [ "$DB" = "mysql" ]; then - echo "== Setting up MySQL" - mysql -u root mysql -e "GRANT ALL PRIVILEGES ON *.* TO bugs@localhost IDENTIFIED BY 'bugs'; FLUSH PRIVILEGES;" -fi - -# PostgreSQL related setup -if [ "$DB" = "pg" ]; then - echo "== Setting up PostgreSQL" - sudo -u postgres createuser --superuser bugs - sudo -u postgres psql -U postgres -d postgres -c "alter user bugs with password 'bugs';" -fi - # Checksetup test which tests schema changes from older versions to the current if [ "$TEST_SUITE" = "checksetup" ] && [ "$DB" = "mysql" ]; then echo "== Running checksetup upgrade tests for MySQL" From 1cd0b5b026f9da8a8a552a08b0d95ebaafe91f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Buclin?= Date: Mon, 14 Sep 2015 20:13:27 +0200 Subject: [PATCH 25/25] Make sure large login names are rejected, see bug 1202447 --- t/test_create_user_accounts.t | 3 +++ t/webservice_user_create.t | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/t/test_create_user_accounts.t b/t/test_create_user_accounts.t index 86bc68b..63ac0ab 100644 --- a/t/test_create_user_accounts.t +++ b/t/test_create_user_accounts.t @@ -61,6 +61,9 @@ foreach my $account (@accounts) { # These accounts are illegal. @accounts = ('test\bugzilla@bugzilla.test', 'test@bugzilla.org@bugzilla.test'); +# Logins larger than 127 characters must be rejected, for security reasons. +push @accounts, 'selenium-' . random_string(110) . '@bugzilla.test'; + foreach my $account (@accounts) { $sel->click_ok("link=New Account"); $sel->wait_for_page_to_load_ok(WAIT_TIME); diff --git a/t/webservice_user_create.t b/t/webservice_user_create.t index 2774e72..b6216ca 100644 --- a/t/webservice_user_create.t +++ b/t/webservice_user_create.t @@ -6,7 +6,7 @@ use strict; use warnings; use lib qw(lib); use QA::Util; -use Test::More tests => 69; +use Test::More tests => 75; my ($config, $xmlrpc, $jsonrpc, $jsonrpc_get) = get_rpc_clients(); use constant NEW_PASSWORD => 'password'; @@ -18,7 +18,7 @@ use constant PASSWORD_TOO_SHORT => 'a'; use constant INVALID_EMAIL => '()[]\;:,<>@webservice.test'; sub new_login { - return 'created_' . random_string() . '@webservice.test'; + return 'created_' . random_string(@_) . '@webservice.test'; } sub post_success { @@ -68,6 +68,12 @@ foreach my $rpc ($jsonrpc, $xmlrpc) { error => "didn't pass our syntax checking", test => 'Invalid email address fails', }, + { user => 'admin', + args => { email => new_login(128), full_name => NEW_FULLNAME, + password => NEW_PASSWORD }, + error => "didn't pass our syntax checking", + test => 'Too long (> 127 chars) email address fails', + }, { user => 'admin', args => { email => $config->{unprivileged_user_login}, full_name => NEW_FULLNAME, password => NEW_PASSWORD },