From 4e26ebfbe24e2f8590e3d61675435255ee88c25d Mon Sep 17 00:00:00 2001 From: Alan Rynne Date: Tue, 20 Apr 2021 19:47:44 +0200 Subject: [PATCH 1/7] ci: First coin-flip on Spinning up a Docker server for each test --- .circleci/config.yml | 31 ++++++++++++++++++++++++------- tests/conftest.py | 2 +- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9d8798d..67b49fb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,12 +2,30 @@ version: 2.1 orbs: python: circleci/python@1.3.2 - + jobs: build: - executor: - name: python/default - tag: << parameters.tag >> + docker: + - image: "cimg/python:<>" + - image: "circleci/node:12" + - image: "circleci/redis:6" + - image: "circleci/postgres:12" + environment: + POSTGRES_DB: speckle2_test + POSTGRES_PASSWORD: speckle + POSTGRES_USER: speckle + - image: "speckle/speckle-server:5f8cf11cba07ea6a54000243f9cb343b61cbba13" + command: ["bash", "-c", "/wait && node bin/www"] + environment: + POSTGRES_URL: "localhost" + POSTGRES_USER: "speckle" + POSTGRES_PASSWORD: "speckle" + POSTGRES_DB: "speckle2_test" + REDIS_URL: "redis://localhost" + SESSION_SECRET: "keyboard cat" + STRATEGY_LOCAL: "true" + CANONICAL_URL: "http://localhost:3000" + WAIT_HOSTS: localhost:5432, localhost:6379 parameters: tag: default: "3.8" @@ -15,13 +33,13 @@ jobs: steps: - checkout - run: python --version - - run: + - run: command: python -m pip install --upgrade pip name: upgrade pip - python/install-packages: pip-dependency-file: requirements.txt pkg-manager: pip - - run: pytest --version + - run: pytest --version workflows: main: @@ -32,4 +50,3 @@ workflows: version: ["3.6", "3.7", "3.8", "3.9"] pkg-manager: pip test-tool: pytest - \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py index 7f919c2..6086680 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -11,7 +11,7 @@ from specklepy.objects.fakemesh import FakeMesh @pytest.fixture(scope="session") def host(): - return "latest.speckle.dev" + return "localhost:3000" def seed_user(host): From a6543b122fdf17267a1b686ab2f11dd41d8aeb58 Mon Sep 17 00:00:00 2001 From: Alan Rynne Date: Tue, 20 Apr 2021 19:56:34 +0200 Subject: [PATCH 2/7] =?UTF-8?q?ci:=20Checking=20build=20script=20only...?= =?UTF-8?q?=20=F0=9F=A4=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .circleci/config.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 67b49fb..06eb2e9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,9 +44,10 @@ jobs: workflows: main: jobs: - - python/test: - matrix: - parameters: - version: ["3.6", "3.7", "3.8", "3.9"] - pkg-manager: pip - test-tool: pytest + - build + # - python/test: + # matrix: + # parameters: + # version: ["3.6", "3.7", "3.8", "3.9"] + # pkg-manager: pip + # test-tool: pytest From da2d646f78cdbf06fc57f5d2e9358830dfb2c488 Mon Sep 17 00:00:00 2001 From: Alan Rynne Date: Tue, 20 Apr 2021 20:00:06 +0200 Subject: [PATCH 3/7] ci: Testing matrix versions --- .circleci/config.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 06eb2e9..ac5bb12 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,10 +44,7 @@ jobs: workflows: main: jobs: - - build - # - python/test: - # matrix: - # parameters: - # version: ["3.6", "3.7", "3.8", "3.9"] - # pkg-manager: pip - # test-tool: pytest + - build: + matrix: + parameters: + tag: ["3.6", "3.7", "3.8", "3.9"] From 0428d2149f14a6446d7eb513abaeb9cb81bd78a2 Mon Sep 17 00:00:00 2001 From: Alan Rynne Date: Tue, 20 Apr 2021 20:03:18 +0200 Subject: [PATCH 4/7] ci: Run those tests! --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ac5bb12..44464f5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,7 +39,7 @@ jobs: - python/install-packages: pip-dependency-file: requirements.txt pkg-manager: pip - - run: pytest --version + - run: pytest workflows: main: From ed92678a315177c7a62b78af4e1ab1af59153256 Mon Sep 17 00:00:00 2001 From: Alan Rynne Date: Tue, 20 Apr 2021 20:08:14 +0200 Subject: [PATCH 5/7] ci: Random test with "http" --- tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 6086680..42d047b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -24,13 +24,13 @@ def seed_user(host): } r = requests.post( - url=f"https://{host}/auth/local/register?challenge=pyspeckletests", + url=f"http://{host}/auth/local/register?challenge=pyspeckletests", data=user_dict, ) access_code = r.url.split("access_code=")[1] r_tokens = requests.post( - url=f"https://{host}/auth/token", + url=f"http://{host}/auth/token", json={ "appSecret": "spklwebapp", "appId": "spklwebapp", From 3f7290ed12be4cab6d301f27bfbe2dbc051dd7ca Mon Sep 17 00:00:00 2001 From: Alan Rynne Date: Tue, 20 Apr 2021 20:17:01 +0200 Subject: [PATCH 6/7] ci: Reverting --- tests/conftest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 42d047b..7f919c2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -11,7 +11,7 @@ from specklepy.objects.fakemesh import FakeMesh @pytest.fixture(scope="session") def host(): - return "localhost:3000" + return "latest.speckle.dev" def seed_user(host): @@ -24,13 +24,13 @@ def seed_user(host): } r = requests.post( - url=f"http://{host}/auth/local/register?challenge=pyspeckletests", + url=f"https://{host}/auth/local/register?challenge=pyspeckletests", data=user_dict, ) access_code = r.url.split("access_code=")[1] r_tokens = requests.post( - url=f"http://{host}/auth/token", + url=f"https://{host}/auth/token", json={ "appSecret": "spklwebapp", "appId": "spklwebapp", From d07bab61e7542e4eb9f303b5f694e27b81d8f1a1 Mon Sep 17 00:00:00 2001 From: Alan Rynne Date: Wed, 21 Apr 2021 10:05:18 +0200 Subject: [PATCH 7/7] ci: Fixes with Izzy --- tests/conftest.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 7f919c2..096cc86 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -11,7 +11,7 @@ from specklepy.objects.fakemesh import FakeMesh @pytest.fixture(scope="session") def host(): - return "latest.speckle.dev" + return "localhost:3000" def seed_user(host): @@ -24,13 +24,14 @@ def seed_user(host): } r = requests.post( - url=f"https://{host}/auth/local/register?challenge=pyspeckletests", + url=f"http://{host}/auth/local/register?challenge=pyspeckletests", data=user_dict, ) + print(r.url) access_code = r.url.split("access_code=")[1] r_tokens = requests.post( - url=f"https://{host}/auth/token", + url=f"http://{host}/auth/token", json={ "appSecret": "spklwebapp", "appId": "spklwebapp", @@ -56,7 +57,7 @@ def second_user_dict(host): @pytest.fixture(scope="session") def client(host, user_dict): - client = SpeckleClient(host=host, use_ssl=True) + client = SpeckleClient(host=host, use_ssl=False) client.authenticate(user_dict["token"]) return client