Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test-functional-microshift.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
PYTHONWARNINGS: ignore
KUBECONFIG: ${{ github.workspace }}/kubeconfig
ACCT_MGT_VERSION: "cecbe131843e5033ab6f6fdce2b5a8af58d80f9d"
DB_URL: "postgres://postgres:postgres@localhost:5432/postgres"

jobs:
build:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/test-functional-microstack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [ main ]

env:
DB_URL: "postgres://postgres:postgres@localhost:5432/postgres"

jobs:
build:
runs-on: ubuntu-22.04
Expand All @@ -18,11 +21,9 @@ jobs:
with:
python-version: 3.12

- name: Install ColdFront and plugin
- name: Install dependencies, ColdFront and plugin
run: |
python -m pip install --upgrade pip
pip install -r test-requirements.txt
pip install -e .
./ci/setup.sh

- name: Install and start Ceph RadosGW
run: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/test-unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [ main ]

env:
DB_URL: "postgres://postgres:postgres@localhost:5432/postgres"

jobs:
build:
runs-on: ubuntu-22.04
Expand All @@ -18,7 +21,7 @@ jobs:
with:
python-version: 3.12

- name: Install ColdFront and plugin
- name: Install dependancies, ColdFront and plugin
run: |
./ci/setup.sh

Expand Down
4 changes: 4 additions & 0 deletions ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
set -xe

# If running on Github actions, don't create a virtualenv
# Else install postgres
if [[ ! "${CI}" == "true" ]]; then
virtualenv -p python3 /tmp/coldfront_venv
source /tmp/coldfront_venv/bin/activate
else
sudo systemctl start postgresql.service
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
fi

python -m pip install --upgrade pip
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import uuid
import tempfile

from django.db import connection
from django.core.management import call_command
from coldfront.core.project.models import Project
from coldfront.core.field_of_science.models import FieldOfScience
Expand All @@ -9,6 +11,19 @@


class TestFixAllocation(base.TestBase):
def setUp(self) -> None:
"""
Because Coldfront manually sets the IDs of FieldOfScience (FOS) entries, this creates a mismatch
between the actual FOS IDs and the sequence that Postgres uses to auto-increment them
"""
super().setUp()

if os.getenv("DB_URL"):
with connection.cursor() as cursor:
cursor.execute(
'SELECT setval(pg_get_serial_sequence(\'field_of_science_fieldofscience\',\'id\'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "field_of_science_fieldofscience";'
)

def test_command_output(self):
old_fos_1 = self.new_field_of_science()
old_fos_2 = self.new_field_of_science()
Expand Down
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ python-keystoneclient
python-novaclient
python-neutronclient
python-swiftclient
psycopg2
Loading