Skip to content

Commit

Permalink
Update usage scenario to get the yaml file parsing
Browse files Browse the repository at this point in the history
We still have a build issue to resolve
  • Loading branch information
mrchrisadams committed May 15, 2024
1 parent 71f0f5e commit f437109
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 36 deletions.
8 changes: 4 additions & 4 deletions green_metric_tests/greencheck_test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ const expect = require('chai').expect;

describe('Greencheck API', () => {
it('Has the correct URL property', () => {
request('https://django:8000')
request('https://django:9000')
.get('/greencheck/climateaction.tech')
.expect(200)
.expect('Content-Type', 'application/json')
.expect(function(res) {
.expect(function (res) {
if (!res.body.hasOwnProperty('url')) throw new Error("Expected 'url' key!");
})
.end(function(err, res){
.end(function (err, res) {
if (err) throw err;
})
});
});
});
70 changes: 38 additions & 32 deletions usage_scenario.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Greencheck Test
author: James Camilleri <jcamilleri@scottlogic.com>
author: James Camilleri <jcamilleri@scottlogic.com>, Chris Adams <chris@greenweb.org>
description: Scenario to test the Greencheck endpoint of the Green Web Foundation Greencheck API

version: "3.5"
Expand All @@ -10,39 +10,44 @@ networks:

services:
mariadb:
image: mariadb:10.3
image: mariadb:10.11
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: just-for-github-actions
MYSQL_DATABASE: greencheck
environment:
- MYSQL_ROOT_PASSWORD=deploy
- MYSQL_DATABASE=greencheck
- MYSQL_USER=deploy
- MYSQL_PASSWORD=deploy
# not sure which of these take precedence now
# env:
# MYSQL_ROOT_PASSWORD: just-for-github-actions
# MYSQL_DATABASE: greencheck
networks:
- greencheck-network

rabbitmq:
image: rabbitmq:3.9
env:
RABBITMQ_USERNAME: "guest"
RABBITMQ_PASSWORD: "guest"
image: rabbitmq:3.11
restart: always
ports:
- 5672:5672
options: '--hostname "rmq" --health-cmd "rabbitmqctl status" --health-interval 10s --health-timeout 10s --health-retries 3 --health-start-period 60s'
networks:
- greencheck-network

django:
image: greenweb-app
depends_on:
- mariadb
- rabbitmq
build:
context: .
args:
PIPENV_CFG: --dev
command:
- cp -a . .
- python -m pip install --upgrade pipenv wheel
- pipenv install --deploy --dev --verbose
dockerfile: Dockerfile
env_file:
- path: ./.env.docker
ports:
- "8000:8000"
- 9000:9000
expose:
- 9000
restart: on-failure
volumes:
- .:/app
Expand All @@ -53,26 +58,27 @@ services:

test-container:
container_name: test-container
image: node
depends_on: django
image: node
depends_on:
- django
setup-commands:
- cp ./green_metric_tests/greencheck_test.spec.js .
- cp ./green_metric_tests/package.json .
- npm install
networks:
- greencheck-network

flow:
- name: Greencheck API Test
container: test-container
commands:
- type: console
command: npm test
note: Starting test
read-notes-stdout: true
- type: console
command: sleep 30
note: Idling
- type: console
command: npm test
note: Starting test again
flow:
- name: Greencheck API Test
container: test-container
commands:
- type: console
command: npm test
note: Starting test
read-notes-stdout: true
- type: console
command: sleep 30
note: Idling
- type: console
command: npm test
note: Starting test again

0 comments on commit f437109

Please sign in to comment.