Bug#847555: tracker.debian.org: Functional testing suite seems broken

2016-12-10 Thread efkin
Raphael Hertzog  writes:

> On Fri, 09 Dec 2016, efkin wrote:
>> Raphael Hertzog  writes:
>> 
>> > On Fri, 09 Dec 2016, efkin wrote:
>> >> I looked for the driver but it was not on stable/main so went for
>> >> chromedriver. And the situation improved considireously. Then realized
>> >> that improper method was used for closing the driver, leading to
>> >> undesired spwaning of driver processes.
>> >
>> > Thanks, I applied your patches. But while you say that the situation
>> > improved, I still see failures (both on jessie and on stretch/sid). Do you
>> > plan to look into those failures?
>> 
>> I'm on it! Just attached some patches that should fix most part of
>> functional_test suite:
>
> Nice, a few comments to fix and I'll merge your work!

Thx! I'm attaching new patches in different order.

>> Subject: [PATCH 1/5] Update session hash after password change
>> 
>> Since Django >= 1.7 SessionAuthenticationMiddleware invalidates
>> session after password change.
>>
>>  def form_valid(self, form, *args, **kwargs):
>>  form.save()
>> +update_session_auth_hash(self.request, form.user)
>>  return super(PasswordChangeView, self).form_valid(form, *args, 
>> **kwargs)
>
> Do we want to revert this behaviour change of Django or should we rather
> fix the functional test to re-log after the password change?
> I did not look the reason for the change but I would rather be on the safe
> side and follow Django's default behaviour and hence modify the test.

You're right. It's a good concern. See patch #3 with the changes.

>> Subject: [PATCH 2/5] Add missing Architecture test fixture
>> 
>> With this fixture, RepositoryAdminTest.test_respository_add()
>> can be executed smoothly.
>> ---
>>  distro_tracker/core/fixtures/repository-architectures-test-fixture.json | 1 
>> +
>>  functional_tests/tests.py   | 2 
>> ++
>>  2 files changed, 3 insertions(+)
>>  create mode 100644 
>> distro_tracker/core/fixtures/repository-architectures-test-fixture.json
>
> Why do we need this fixture? The architectures should be created as part
> of the initial migrations, see
> distro_tracker/core/migrations/0002_initial_data.py and
> 0006_more_architectures.py.
>
>> +call_command('loaddata', 
>> 'distro_tracker/core/fixtures/repository-architectures-test-fixture.json', 
>> verbosity=0)
>
> If we really need a fixture, we should load it throught the fixture
> attribute on the class:
> https://docs.djangoproject.com/en/1.10/topics/testing/tools/#django.test.TransactionTestCase.fixtures

Well, i'm not sure if the migrations that you mentioned also works for
testing database. I tried to run test with verbose level 3 and the
migration is applied but no data is fulfilled. So i went for fixtures.
Next issue was that using fixture attribute worked only if the test was
executed singularly for the RepositoryAdminTestCase via `./manage.py
test functional_tests.tests.RepositoryAdminTestCase` but, if executed
the whole test suite it was not loading the fixture. Maybe due to
chaining of subclasses. So i used the `loaddata` command that is what
`fixtures` attribute calls under the hood i guess.


>> Subject: [PATCH 3/5] Fix wrong URL
>> 
>> It was causing Timeout Error on test suite execution.
>> ---
>>  # The user goes to the package page
>> -self.get_page('/' + package_name)
>> +self.get_page('/pkg/' + package_name)
>
> The "/foo" URL should end up being redirected to "/pkg/foo" if the package
> exists. Why is the redirection not properly working here?

It is working. It was my browser that was not loading fast enough the
redirect. So i excluded this patch from the new set.



>> From fba692e2e68e44745da137da10104fa1544016a9 Mon Sep 17 00:00:00 2001
>> From: efkin 
>> Date: Fri, 9 Dec 2016 19:07:28 +0100
>> Subject: [PATCH 5/5] Add missing html id tag
>> 
>> It was violating SubscribeToPackageTest class.
>
> I think I dropped it in the conversion to bootstrap v4 because I found no
> use of it... I missed this obviously.

So i kept this patch on the patch set.

> Cheers,

Cheers,

> -- 
> Raphaël Hertzog ◈ Debian Developer
>
> Support Debian LTS: http://www.freexian.com/services/debian-lts.html
> Learn to master Debian: http://debian-handbook.info/get/
-- 
efkin.

>From e1c4f4879f7a5e8c742aedd57e9e967cdeb2 Mon Sep 17 00:00:00 2001
From: efkin 
Date: Fri, 9 Dec 2016 17:41:17 +0100
Subject: [PATCH 1/4] Fix too short await time

This caused a Timeout Error on test suite execution.
---
 functional_tests/tests.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/functional_tests/tests.py b/functional_tests/tests.py
index 37dbf0a..95ad084 100644
--- a/functional_tests/tests.py
+++ b/functional_tests/tests.py
@@ -790,7 +790,7 @@ class SubscribeToPackageTest(UserAccountsTestMixin, SeleniumTestCase):
 # The subscribe button is no longer found in the page
 button = self.get_element_by_id('subscribe-button')
 # ==

Bug#847555: marked as done (tracker.debian.org: Functional testing suite seems broken)

2016-12-10 Thread Debian Bug Tracking System
Your message dated Sat, 10 Dec 2016 21:43:28 +0100
with message-id <20161210204328.cnd35klzxi6sf...@home.ouaza.com>
and subject line Re: Bug#847555: tracker.debian.org: Functional testing suite 
seems broken
has caused the Debian Bug report #847555,
regarding tracker.debian.org: Functional testing suite seems broken
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
847555: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=847555
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: tracker.debian.org
Severity: normal
Tags: patch

Dear Maintainer,

I wanted to work on some fixes for tracker.d.o. so i setup a stable kvm for 
better isolation but the functional
test suite seemed broken. Also the docs were missing the reference
to the driver.

I looked for the driver but it was not on stable/main so went for chromedriver. 
And the situation improved considireously. Then realized that improper method 
was used for closing the driver, leading to undesired spwaning of driver 
processes.

bests,

efkin.

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.8.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
>From fb1098e4f74ef5a225b0dfc5fd206b06a8b33d21 Mon Sep 17 00:00:00 2001
From: efkin 
Date: Fri, 9 Dec 2016 11:44:00 +0100
Subject: [PATCH 1/2] Use chromedriver instead of firefoxdriver

The testing suite should be executable from within
debian stable.
---
 docs/setup/setup.rst  | 5 -
 functional_tests/tests.py | 7 ---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/docs/setup/setup.rst b/docs/setup/setup.rst
index eb0d116..9a4810c 100644
--- a/docs/setup/setup.rst
+++ b/docs/setup/setup.rst
@@ -24,6 +24,9 @@ Distro Tracker currently depends on the following Debian packages:
 - python-soappy (optional)
 - python-ldap (optional)
 - python-tox (for development only)
+- python-selenium (for development only)
+- chromedriver (for development only)
+- chromium (for development only)
 
 For Python2.7, the following additional packages are required:
 
@@ -32,7 +35,7 @@ For Python2.7, the following additional packages are required:
 
 Here is the list of required packages for development on Debian Jessie::
 
- $ sudo aptitude install python-django python-requests python-django-jsonfield python-django-debug-toolbar python-debian python-apt python-gpgme python-yaml python-bs4 python-soappy python-ldap python-pyinotify python-tox python-mock python-lzma python3-django python3-requests python3-django-jsonfield python3-django-debug-toolbar python3-debian python3-apt python3-gpgme python3-yaml python3-bs4 python3-pyinotify
+ $ sudo aptitude install python-django python-requests python-django-jsonfield python-django-debug-toolbar python-debian python-apt python-gpgme python-yaml python-bs4 python-soappy python-ldap python-pyinotify python-tox python-mock python-lzma python-selenium python3-django python3-requests python3-django-jsonfield python3-django-debug-toolbar python3-debian python3-apt python3-gpgme python3-yaml python3-bs4 python3-pyinotify python3-selenium chromium chromedriver
 
 .. _database_setup:
 
diff --git a/functional_tests/tests.py b/functional_tests/tests.py
index 5f60290..734fd67 100644
--- a/functional_tests/tests.py
+++ b/functional_tests/tests.py
@@ -46,9 +46,10 @@ class SeleniumTestCase(LiveServerTestCase):
 """
 def setUp(self):
 os.environ['NO_PROXY'] = 'localhost,127.0.0.1,127.0.1.1'
-fp = webdriver.FirefoxProfile()
-fp.set_preference('network.proxy.type', 0)
-self.browser = webdriver.Firefox(firefox_profile=fp)
+
+chromedriver = "/usr/lib/chromium/chromedriver"
+os.environ["webdriver.chrome.driver"] = chromedriver
+self.browser = webdriver.Chrome(chromedriver)
 self.browser.implicitly_wait(3)
 self.browser.set_page_load_timeout(3)
 self.browser.set_script_timeout(3)
-- 
2.1.4

>From c74e362d9168a80d58ad2d1d20e1a3e4844c1945 Mon Sep 17 00:00:00 2001
From: efkin 
Date: Fri, 9 Dec 2016 11:46:48 +0100
Subject: [PATCH 2/2] Selenium spawning too many driver's processes

According to documentation .quit() is the proper method
to close all existing tabs and exit the process.
---
 functional_tests/tests.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/functional_tests/tests.py b/functional_tests/tests.py
index 734f

[PATCH] reproducible FreeBSD: Fix tar argument order for tar 1.28

2016-12-10 Thread Anders Kaseorg
--no-recursion now only applies to the following arguments.  See
https://bugs.debian.org/829738.

Signed-off-by: Anders Kaseorg 
---
 bin/reproducible_freebsd.sh | 2 +-
 hosts/freebsd-jenkins/usr/local/etc/sudoers | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/reproducible_freebsd.sh b/bin/reproducible_freebsd.sh
index da5c407f..6056ea56 100755
--- a/bin/reproducible_freebsd.sh
+++ b/bin/reproducible_freebsd.sh
@@ -32,7 +32,7 @@ save_freebsd_results() {
# copy results over
DUMMY_DATE="$(date -u +'%Y-%m-%d')T00:00:00Z"
$RSSH "sudo find $TMPDIR -newer $TMPDIR -exec touch -d '$DUMMY_DATE' {} 
\;"
-   $RSSH "sudo find $TMPDIR -print0 | LC_ALL=C sort -z | sudo tar --null 
-T - --no-recursion -cJf $TMPDIR.tar.xz"
+   $RSSH "sudo find $TMPDIR -print0 | LC_ALL=C sort -z | sudo tar 
--no-recursion --null -T - -cJf $TMPDIR.tar.xz"
$RSCP:$TMPDIR.tar.xz $TMPDIR/$RUN/$TARGET_NAME.tar.xz
$RSSH "sudo chflags -R noschg $TMPDIR ; sudo rm -r $TMPDIR 
$TMPDIR.tar.xz ; mkdir $TMPDIR"
 }
diff --git a/hosts/freebsd-jenkins/usr/local/etc/sudoers 
b/hosts/freebsd-jenkins/usr/local/etc/sudoers
index 5408368a..06e26d9f 100644
--- a/hosts/freebsd-jenkins/usr/local/etc/sudoers
+++ b/hosts/freebsd-jenkins/usr/local/etc/sudoers
@@ -104,7 +104,7 @@ jenkins ALL= NOPASSWD: /usr/bin/make -j ? buildworld, \
/usr/sbin/chown jenkins /usr/src, \
/usr/bin/find /srv/reproducible-results/* -newer 
/srv/reproducible-results/* -exec touch *, \
/usr/bin/find /srv/reproducible-results/* -print0, \
-   /usr/bin/tar --null -T - --no-recursion -cJf *.tar.xz, \
+   /usr/bin/tar --no-recursion --null -T - -cJf *.tar.xz, \
/usr/sbin/service ntpd start, \
/usr/sbin/service ntpd stop, \
/usr/sbin/service ntpd status, \
-- 
2.11.0



Re: [PATCH] reproducible FreeBSD: Fix tar argument order for tar 1.28

2016-12-10 Thread Mattia Rizzolo
On Sat, Dec 10, 2016 at 03:40:08PM -0500, Anders Kaseorg wrote:
> --no-recursion now only applies to the following arguments.  See
> https://bugs.debian.org/829738.

Thank you for this patch, I applied it.  I haven't deployed, since the
host seems to be down/unreachable atm, but I'm sure Holger will do soon.


Anyhow, the most proper place to send patches for jenkins stuff is the
qa-jenkins-...@lists.alioth.debian.org ML
https://lists.alioth.debian.org/cgi-bin/mailman/listinfo/qa-jenkins-dev

And we generally prefer a pointer to a public git repository and a
commit hash over plain emails like this one - but if you've just a
one-shot patch this work too :)
Also, do whathever works best for you: anything's better than no
patches! :D

-- 
regards,
Mattia Rizzolo

GPG Key: 66AE 2B4A FCCF 3F52 DA18  4D18 4B04 3FCD B944 4540  .''`.
more about me:  https://mapreri.org : :'  :
Launchpad user: https://launchpad.net/~mapreri  `. `'`
Debian QA page: https://qa.debian.org/developer.php?login=mattia  `-


signature.asc
Description: PGP signature