Skip to content

Commit 09234c9

Browse files
authored
Travis: Separating Postgres & Mongo scripts (parse-community#6505)
* Attempting to fix Postgres issue * Attempting to fix Postgres issue trying to stop loop * Attempting to fix Postgres isolating postgres calls * Attempting to fix Postgres issue Separating jobs * Attempting to fix postgres * Attempting to fix postgres * Attempting to fix postgres Separating builds again * Attempting to fix postgres * Attempting to fix postgres * Attempting to fix postgres Just added back version 10, just in case it gets called * Attempting to fix postgres * Attempting to fix postgres * Attempting to fix postgres * Attempting to fix postgres * Attempting to fix postgres * Attempting to fix postgres * Attempting to fix postgres * Attempting to fix postgres * Attempting to fix postgres * Attempting to fix postgres * Update .travis.yml * Attempting to fix postgres Removed postgres installs from unneeded test cases. Added the ability to test Postgres 10 and 11 * Attempting to fix postgres * Attempting to fix postgres * Attempting to fix postgres * Attempting to fix postgres Added test for postgres 12 that's allowed to fail * Attempting to fix postgres * Attempting to fix postgres Second round to see if it fails eventually * Attempting to fix postgres Round 3 * Attempting to fix postgres Allowing all postgres to fail since it seems to occur randomly * Temporary fix: separated mongo and postgres in travis Now the mongo and postgres scripts are independent of each other to prevent the `ERROR: could not access file "$libdir/postgis-2.4": No such file or directory` of showing up in the rest of the builds. In addition, a test for postgres-12 has been added for future compatibility. Both the postgres-11 and postgres-12 have been added to `allow_failures` because the aforementioned error still creeps up. Important note is that the error has nothing to do with compatibility with postgres, but rather seems to be an error of how postgres (or really postgis) is being referenced in the respective travis distribution. Lastly, this error, if truly random should appear less than before as the postgres scripts aren't being run for every build as it previously was running. * Allowing all postgres to fail * Allowing multiple names to fail * Removing preinstalled versions of postgres from list Seeing if this gets rid of the random error * Use postgres made for dist * Second round * Round 3 * Round 4 * Round 5 * Fixed issue with random postgres fail Removing the native postgres builds at the right time seems to have fixed the random error from before. The postgres tests are now not allowed to fail. * Added back postgres 11 and 12 to allow_failures The actual problem is fixed, but it seems there are some instability with some of the test cases for postgres that need to be addressed at another time. The issues that pop up are: - Postgres-11 ```Failures: 1) Cloud Code cloud jobs should set the message / success on the job Message: Expected undefined to equal 'hello'. Stack: Error: Expected undefined to equal 'hello'. at <Jasmine> at req.message.then.then.jobStatus (/home/travis/build/parse-community/parse-server/spec/CloudCode.spec.js:1571:46) at process._tickCallback (internal/process/next_tick.js:68:7) ``` - Postgres-12 ``` Failures: 1) Cloud Code cloud jobs should set the message / success on the job Message: Expected undefined to equal 'hello'. Stack: Error: Expected undefined to equal 'hello'. at <Jasmine> at req.message.then.then.jobStatus (/home/travis/build/parse-community/parse-server/spec/CloudCode.spec.js:1571:46) at process._tickCallback (internal/process/next_tick.js:68:7) Message: Expected 'running' to equal 'succeeded'. Stack: Error: Expected 'running' to equal 'succeeded'. at <Jasmine> at promise.then.then.jobStatus (/home/travis/build/parse-community/parse-server/spec/CloudCode.spec.js:1580:45) at process._tickCallback (internal/process/next_tick.js:68:7) ``` * added travis scripts for postgres * Setting up before_install and before_script This should shrink the footprint of the file and and reduce the redundancy of calls for postgres. Added support for testing of Postgres 9 and 10 in the scripts, not adding the tests though * make scripts executable * Update .travis.yml * add sourcing in script * trying to fix source * fixing env var in script * fixed ; near then * Cleaning up travis file removed old lines * Finishing clean up * Fixing allow_failures since "name" was removed * Update .travis.yml * Removed Postgres 11 from allow_failures * I think using travis default postgres port of 5433 will allow us to not have to remove anything from the image * Switching travis to postgres port 5433 * modifying script for test * modifying script for test * modifying script for test * reverting back to working way with removing postgres from image * Reverted back to removing postgres from image * removing postgres 12 * removed postgres-12 from allow_failures
1 parent d3b1791 commit 09234c9

File tree

3 files changed

+61
-14
lines changed

3 files changed

+61
-14
lines changed

.travis.yml

+10-14
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ dist: xenial
44
services:
55
- redis
66
- docker
7-
addons:
8-
postgresql: '11'
9-
apt:
10-
packages:
11-
- postgresql-11-postgis-2.5
12-
- postgresql-11-postgis-2.5-scripts
137
branches:
148
only:
159
- master
@@ -27,22 +21,14 @@ env:
2721
jobs:
2822
- MONGODB_VERSION=4.0.4 MONGODB_TOPOLOGY=replicaset MONGODB_STORAGE_ENGINE=wiredTiger
2923
- MONGODB_VERSION=3.6.9
30-
- PARSE_SERVER_TEST_DB=postgres
3124
- PARSE_SERVER_TEST_CACHE=redis
3225
- NODE_VERSION=12.12.0
3326
before_install:
3427
- nvm install $NODE_VERSION
3528
- nvm use $NODE_VERSION
3629
- npm install -g greenkeeper-lockfile@1
37-
- sudo sed -i 's/port = 5433/port = 5432/' /etc/postgresql/11/main/postgresql.conf
38-
- sudo cp /etc/postgresql/{10,11}/main/pg_hba.conf
39-
- sudo service postgresql stop
40-
- sudo service postgresql start 11
4130
before_script:
4231
- node -e 'require("./lib/index.js")'
43-
- psql -c 'create database parse_server_postgres_adapter_test_database;' -U postgres
44-
- psql -c 'CREATE EXTENSION postgis;' -U postgres -d parse_server_postgres_adapter_test_database
45-
- psql -c 'CREATE EXTENSION postgis_topology;' -U postgres -d parse_server_postgres_adapter_test_database
4632
- greenkeeper-lockfile-update
4733
script:
4834
- npm run lint
@@ -54,6 +40,16 @@ jobs:
5440
allow_failures:
5541
- env: NODE_VERSION=12.12.0
5642
include:
43+
- stage:
44+
addons:
45+
postgresql: '11'
46+
apt:
47+
packages:
48+
- postgresql-11-postgis-2.5
49+
- postgresql-11-postgis-2.5-scripts
50+
env: POSTGRES_MAJOR_VERSION=11 PARSE_SERVER_TEST_DB=postgres
51+
before_install: bash scripts/before_install_postgres.sh
52+
before_script: bash scripts/before_script_postgres.sh
5753
- stage: release
5854
node_js: '10'
5955
env:

scripts/before_install_postgres.sh

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
source ~/.nvm/nvm.sh
6+
7+
echo "[SCRIPT] Before Install Script :: Setup Postgres ${POSTGRES_MAJOR_VERSION}"
8+
9+
nvm install $NODE_VERSION
10+
nvm use $NODE_VERSION
11+
npm install -g greenkeeper-lockfile@1
12+
13+
sudo sed -i 's/port = 5433/port = 5432/' /etc/postgresql/${POSTGRES_MAJOR_VERSION}/main/postgresql.conf
14+
15+
if [[ $POSTGRES_MAJOR_VERSION -lt 11 ]]; then
16+
# Setup postgres 9 or 10
17+
sudo service postgresql stop
18+
19+
# Remove correct version of postgres
20+
if [[ $POSTGRES_MAJOR_VERSION -lt 10 ]]; then
21+
sudo apt-get remove -q 'postgresql-10.*'
22+
else
23+
sudo apt-get remove -q 'postgresql-9.*'
24+
fi
25+
26+
sudo service postgresql start ${POSTGRES_MAJOR_VERSION}
27+
28+
else
29+
30+
# Setup postgres 11 or higher
31+
sudo cp /etc/postgresql/{10,${POSTGRES_MAJOR_VERSION}}/main/pg_hba.conf
32+
sudo service postgresql stop
33+
# Remove previous versions of postgres
34+
sudo apt-get remove -q 'postgresql-9.*' 'postgresql-10.*'
35+
sudo service postgresql start ${POSTGRES_MAJOR_VERSION}
36+
fi

scripts/before_script_postgres.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
echo "[SCRIPT] Before Script :: Setup Parse DB for Postgres ${POSTGRES_MAJOR_VERSION}"
6+
7+
node -e 'require("./lib/index.js")'
8+
9+
psql -v ON_ERROR_STOP=1 --username "postgres" --dbname "${POSTGRES_DB}" <<-EOSQL
10+
CREATE DATABASE parse_server_postgres_adapter_test_database;
11+
\c parse_server_postgres_adapter_test_database;
12+
CREATE EXTENSION postgis;
13+
CREATE EXTENSION postgis_topology;
14+
EOSQL
15+

0 commit comments

Comments
 (0)