diff mbox series

[v2,1/3] travis: test against postgresql 10 and 11

Message ID 20180806065639.23094-1-daniel@linux.ibm.com
State Accepted
Headers show
Series [v2,1/3] travis: test against postgresql 10 and 11 | expand

Commit Message

Daniel Black Aug. 6, 2018, 6:56 a.m. UTC
Signed-off-by: Daniel Black <daniel@linux.ibm.com>
---
 .travis.yml | 51 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 49 insertions(+), 2 deletions(-)

Comments

Daniel Axtens Aug. 9, 2018, 3:12 p.m. UTC | #1
Hi Daniel,

> +matrix:
> +  include:
> +    - addons:
> +        postgresql: "10"
> +        apt:
> +          packages:
> +          - postgresql-10
> +          - postgresql-client-10
> +      env:
> +        - PGPORT=5433
> +        - PW_TEST_DB_PORT=5433
> +        - PW_TEST_DB_TYPE=postgres
> +        - PW_TEST_DB_USER=travis
> +        - PW_TEST_DB_PASS=""


The password is redundant here as it's also supplied in the global: var
list.

It's not documented in the commit message, but if I understand
correctly, the reason you need to specify PGPORT and PW_TEST_DB_PORT is
because the postgres server runs _in addition to_ the original 9.6
server on 5432. So the new server picks 5433 and we need to tell psql
(PGPORT) and patchwork (PW_TEST_DB_PORT) about it.

If you end up doing a respin of this series for patch 2, please change
these things. If we end up keeping patch 2 as is or dropping it
entirely, I'll just make these changes when I merge.

> +      python: 3.6
> +      sudo: true
> +      before_install:
> +        - sudo -u postgres psql -c "grant ALL on DATABASE postgres to travis WITH GRANT OPTION;"
> +    - env:
> +        - PGPORT=5433
> +        - PW_TEST_DB_PORT=5433
> +        - PW_TEST_DB_TYPE=postgres
> +        - PW_TEST_DB_USER=travis
> +        - PW_TEST_DB_PASS=""
> +      python: 3.6
> +      dist: trusty
> +      addons:
> +        postgresql: "11"
> +        apt:
> +          sources:
> +          - sourceline: 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg 11'
> +            key_url: 'https://www.postgresql.org/media/keys/ACCC4CF8.asc'
> +          packages:
> +          - postgresql-11
> +          - postgresql-client-11
> +      sudo: true
> +      before_install:
> +        - sudo -u postgres psql -c "grant ALL on DATABASE postgres to travis WITH GRANT OPTION;"
> +
> +
>  before_script:
> -  - mysql -e 'create database patchwork character set utf8;'
> -  - psql -c "create database patchwork with ENCODING = 'UTF8';" -U postgres
> +  - if [[ $PW_TEST_DB_TYPE == mysql ]]; then mysql -e 'create database patchwork character set utf8;'; fi
> +  - if [[ $PW_TEST_DB_TYPE == postgres ]]; then psql -c "create database patchwork with ENCODING = 'UTF8';" -U $PW_TEST_DB_USER; fi

Thanks for cleaning this up.

>  script:
> +  - >
> +    if [[ $PW_TEST_DB_TYPE == mysql ]];
> +    then
> +      mysql -e 'SELECT VERSION(), CURRENT_USER();' -u $PW_TEST_DB_USER patchwork;
> +    else
> +      psql -c "SELECT VERSION(), CURRENT_USER, current_database()" -U $PW_TEST_DB_USER patchwork;
> +    fi

I really like this bit, thanks!

>    - tox
>    - tox -e coverage
>  
> -- 
> 2.17.1
>
> _______________________________________________
> Patchwork mailing list
> Patchwork@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork
Daniel Black Aug. 9, 2018, 10:29 p.m. UTC | #2
On Fri, 10 Aug 2018 01:12:28 +1000
Daniel Axtens <dja@axtens.net> wrote:

> Hi Daniel,
> 
> > +matrix:
> > +  include:
> > +    - addons:
> > +        postgresql: "10"
> > +        apt:
> > +          packages:
> > +          - postgresql-10
> > +          - postgresql-client-10
> > +      env:
> > +        - PGPORT=5433
> > +        - PW_TEST_DB_PORT=5433
> > +        - PW_TEST_DB_TYPE=postgres
> > +        - PW_TEST_DB_USER=travis
> > +        - PW_TEST_DB_PASS=""  
> 
> 
> The password is redundant here as it's also supplied in the global:
> var list.

quite right.

> It's not documented in the commit message, but if I understand
> correctly, the reason you need to specify PGPORT and PW_TEST_DB_PORT
> is because the postgres server runs _in addition to_ the original 9.6
> server on 5432. So the new server picks 5433 and we need to tell psql
> (PGPORT)

The server installation I thought also picked up on the PGPORT.

> and patchwork (PW_TEST_DB_PORT) about it.

yes.

> If you end up doing a respin of this series for patch 2, please change
> these things. If we end up keeping patch 2 as is or dropping it
> entirely, I'll just make these changes when I merge.

thanks.

> > +  - if [[ $PW_TEST_DB_TYPE == mysql ]]; then mysql -e 'create
> > database patchwork character set utf8;'; fi
> > +  - if [[ $PW_TEST_DB_TYPE == postgres ]]; then psql -c "create
> > database patchwork with ENCODING = 'UTF8';" -U $PW_TEST_DB_USER;
> > fi  
> 
> Thanks for cleaning this up.

consider moving to utf8mb4 for MySQL at some point. The default is a 3
char version which doesn't cover all.

> >  script:
> > +  - >
> > +    if [[ $PW_TEST_DB_TYPE == mysql ]];
> > +    then
> > +      mysql -e 'SELECT VERSION(), CURRENT_USER();' -u
> > $PW_TEST_DB_USER patchwork;
> > +    else
> > +      psql -c "SELECT VERSION(), CURRENT_USER, current_database()"
> > -U $PW_TEST_DB_USER patchwork;
> > +    fi  
> 
> I really like this bit, thanks!

easy.
Stephen Finucane Oct. 26, 2018, 10:50 a.m. UTC | #3
On Mon, 2018-08-06 at 16:56 +1000, Daniel Black wrote:
> Signed-off-by: Daniel Black <daniel@linux.ibm.com>
> ---
>  .travis.yml | 51 +++++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 49 insertions(+), 2 deletions(-)
> 
> diff --git a/.travis.yml b/.travis.yml
> index 6cb983f..58e0b08 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -23,14 +23,61 @@ env:
>    global:
>      - PW_TEST_DB_PASS=""
>  
> +matrix:
> +  include:
> +    - addons:
> +        postgresql: "10"
> +        apt:
> +          packages:
> +          - postgresql-10
> +          - postgresql-client-10
> +      env:
> +        - PGPORT=5433
> +        - PW_TEST_DB_PORT=5433
> +        - PW_TEST_DB_TYPE=postgres
> +        - PW_TEST_DB_USER=travis
> +        - PW_TEST_DB_PASS=""
> +      python: 3.6
> +      sudo: true
> +      before_install:
> +        - sudo -u postgres psql -c "grant ALL on DATABASE postgres to travis WITH GRANT OPTION;"
> +    - env:
> +        - PGPORT=5433
> +        - PW_TEST_DB_PORT=5433
> +        - PW_TEST_DB_TYPE=postgres
> +        - PW_TEST_DB_USER=travis
> +        - PW_TEST_DB_PASS=""
> +      python: 3.6
> +      dist: trusty
> +      addons:
> +        postgresql: "11"
> +        apt:
> +          sources:
> +          - sourceline: 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg 11'
> +            key_url: 'https://www.postgresql.org/media/keys/ACCC4CF8.asc'
> +          packages:
> +          - postgresql-11
> +          - postgresql-client-11
> +      sudo: true
> +      before_install:
> +        - sudo -u postgres psql -c "grant ALL on DATABASE postgres to travis WITH GRANT OPTION;"

The above has started failing in recent days [1], likely coinciding
with the full release of 11 [2]. I've tried but I can't figure out how
to work around this issue easily. Any chance you could take a look,
Daniel (either one :))?

Stephen

[1] https://travis-ci.org/getpatchwork/patchwork/jobs/446606222
[2] https://www.postgresql.org/about/news/1894/

> +
> +
>  before_script:
> -  - mysql -e 'create database patchwork character set utf8;'
> -  - psql -c "create database patchwork with ENCODING = 'UTF8';" -U postgres
> +  - if [[ $PW_TEST_DB_TYPE == mysql ]]; then mysql -e 'create database patchwork character set utf8;'; fi
> +  - if [[ $PW_TEST_DB_TYPE == postgres ]]; then psql -c "create database patchwork with ENCODING = 'UTF8';" -U $PW_TEST_DB_USER; fi
>  
>  install:
>    - pip install tox-travis
>  
>  script:
> +  - >
> +    if [[ $PW_TEST_DB_TYPE == mysql ]];
> +    then
> +      mysql -e 'SELECT VERSION(), CURRENT_USER();' -u $PW_TEST_DB_USER patchwork;
> +    else
> +      psql -c "SELECT VERSION(), CURRENT_USER, current_database()" -U $PW_TEST_DB_USER patchwork;
> +    fi
>    - tox
>    - tox -e coverage
>
Daniel Axtens Oct. 28, 2018, 2:36 p.m. UTC | #4
> The above has started failing in recent days [1], likely coinciding
> with the full release of 11 [2]. I've tried but I can't figure out how
> to work around this issue easily. Any chance you could take a look,
> Daniel (either one :))?

Ergh, it seems travis is doing something *really* weird. If I apt-get
remove --purge postgres{,-client}-9.{2,3,4,5,6} and then install
postgres{-client,}-11, I get:

...
Setting up postgresql-common (195.pgdg14.04+1) ...
PostgreSQL 9.2 is not installed!
invoke-rc.d: initscript postgresql, action "start" failed.
dpkg: error processing package postgresql-common (--configure):
 subprocess installed post-installation script returned error exit status 31
dpkg: dependency problems prevent configuration of postgresql-11:
 postgresql-11 depends on postgresql-common (>= 194~); however:
  Package postgresql-common is not configured yet.

195.pgdg14.04+1 is the new version, unpacked over 188...

(See https://travis-ci.org/daxtens/patchwork/jobs/447406512 )

I can get a bit further if I also purge postgresql{-client,}-common
(suggesting very much that Travis is monkeying with it) but then the
server seems to ignore PGPORT and I fail on the next step.

(See https://travis-ci.org/daxtens/patchwork/jobs/447409745 )

Stephen: I'd say we can just disable this until it gets fixed if you
want. You have my blessing to merge that without further ado if you'd
like.

Regards,
Daniel


>
> Stephen
>
> [1] https://travis-ci.org/getpatchwork/patchwork/jobs/446606222
> [2] https://www.postgresql.org/about/news/1894/
>
>> +
>> +
>>  before_script:
>> -  - mysql -e 'create database patchwork character set utf8;'
>> -  - psql -c "create database patchwork with ENCODING = 'UTF8';" -U postgres
>> +  - if [[ $PW_TEST_DB_TYPE == mysql ]]; then mysql -e 'create database patchwork character set utf8;'; fi
>> +  - if [[ $PW_TEST_DB_TYPE == postgres ]]; then psql -c "create database patchwork with ENCODING = 'UTF8';" -U $PW_TEST_DB_USER; fi
>>  
>>  install:
>>    - pip install tox-travis
>>  
>>  script:
>> +  - >
>> +    if [[ $PW_TEST_DB_TYPE == mysql ]];
>> +    then
>> +      mysql -e 'SELECT VERSION(), CURRENT_USER();' -u $PW_TEST_DB_USER patchwork;
>> +    else
>> +      psql -c "SELECT VERSION(), CURRENT_USER, current_database()" -U $PW_TEST_DB_USER patchwork;
>> +    fi
>>    - tox
>>    - tox -e coverage
>>  
>
>
> _______________________________________________
> Patchwork mailing list
> Patchwork@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork
Daniel Black Oct. 28, 2018, 9:35 p.m. UTC | #5
On Mon, 29 Oct 2018 01:36:28 +1100
Daniel Axtens <dja@axtens.net> wrote:

> > The above has started failing in recent days [1], likely coinciding
> > with the full release of 11 [2]. I've tried but I can't figure out
> > how to work around this issue easily. Any chance you could take a
> > look, Daniel (either one :))?  
> 
> Ergh, it seems travis is doing something *really* weird.

They may have picked up by removing 11 from the pool:

http://apt.postgresql.org/pub/repos/apt/pool/

Does replacing 11 with 12 work? Appears to still be trusty packages.
diff mbox series

Patch

diff --git a/.travis.yml b/.travis.yml
index 6cb983f..58e0b08 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,14 +23,61 @@  env:
   global:
     - PW_TEST_DB_PASS=""
 
+matrix:
+  include:
+    - addons:
+        postgresql: "10"
+        apt:
+          packages:
+          - postgresql-10
+          - postgresql-client-10
+      env:
+        - PGPORT=5433
+        - PW_TEST_DB_PORT=5433
+        - PW_TEST_DB_TYPE=postgres
+        - PW_TEST_DB_USER=travis
+        - PW_TEST_DB_PASS=""
+      python: 3.6
+      sudo: true
+      before_install:
+        - sudo -u postgres psql -c "grant ALL on DATABASE postgres to travis WITH GRANT OPTION;"
+    - env:
+        - PGPORT=5433
+        - PW_TEST_DB_PORT=5433
+        - PW_TEST_DB_TYPE=postgres
+        - PW_TEST_DB_USER=travis
+        - PW_TEST_DB_PASS=""
+      python: 3.6
+      dist: trusty
+      addons:
+        postgresql: "11"
+        apt:
+          sources:
+          - sourceline: 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg 11'
+            key_url: 'https://www.postgresql.org/media/keys/ACCC4CF8.asc'
+          packages:
+          - postgresql-11
+          - postgresql-client-11
+      sudo: true
+      before_install:
+        - sudo -u postgres psql -c "grant ALL on DATABASE postgres to travis WITH GRANT OPTION;"
+
+
 before_script:
-  - mysql -e 'create database patchwork character set utf8;'
-  - psql -c "create database patchwork with ENCODING = 'UTF8';" -U postgres
+  - if [[ $PW_TEST_DB_TYPE == mysql ]]; then mysql -e 'create database patchwork character set utf8;'; fi
+  - if [[ $PW_TEST_DB_TYPE == postgres ]]; then psql -c "create database patchwork with ENCODING = 'UTF8';" -U $PW_TEST_DB_USER; fi
 
 install:
   - pip install tox-travis
 
 script:
+  - >
+    if [[ $PW_TEST_DB_TYPE == mysql ]];
+    then
+      mysql -e 'SELECT VERSION(), CURRENT_USER();' -u $PW_TEST_DB_USER patchwork;
+    else
+      psql -c "SELECT VERSION(), CURRENT_USER, current_database()" -U $PW_TEST_DB_USER patchwork;
+    fi
   - tox
   - tox -e coverage