Skip to content

Commit

Permalink
Merge pull request #3705 from airqo-platform/staging
Browse files Browse the repository at this point in the history
move to production
  • Loading branch information
Baalmart authored Oct 20, 2024
2 parents c73a134 + c9289e1 commit ce887f9
Show file tree
Hide file tree
Showing 23 changed files with 1,216 additions and 1,323 deletions.
2 changes: 1 addition & 1 deletion k8s/analytics/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ images:
celeryWorker: eu.gcr.io/airqo-250220/airqo-analytics-celery-worker
reportJob: eu.gcr.io/airqo-250220/airqo-analytics-report-job
devicesSummaryJob: eu.gcr.io/airqo-250220/airqo-analytics-devices-summary-job
tag: prod-d0d63dbd-1729340566
tag: prod-c73a134b-1729375524
api:
name: airqo-analytics-api
label: analytics-api
Expand Down
2 changes: 1 addition & 1 deletion k8s/auth-service/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ app:
replicaCount: 3
image:
repository: eu.gcr.io/airqo-250220/airqo-auth-api
tag: prod-d0d63dbd-1729340566
tag: prod-c73a134b-1729375524
nameOverride: ''
fullnameOverride: ''
podAnnotations: {}
Expand Down
2 changes: 1 addition & 1 deletion k8s/auth-service/values-stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ app:
replicaCount: 2
image:
repository: eu.gcr.io/airqo-250220/airqo-stage-auth-api
tag: stage-6fb34054-1729313663
tag: stage-03191d9c-1729435343
nameOverride: ''
fullnameOverride: ''
podAnnotations: {}
Expand Down
2 changes: 1 addition & 1 deletion k8s/device-registry/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ app:
replicaCount: 3
image:
repository: eu.gcr.io/airqo-250220/airqo-device-registry-api
tag: prod-d0d63dbd-1729340566
tag: prod-c73a134b-1729375524
nameOverride: ''
fullnameOverride: ''
podAnnotations: {}
Expand Down
2 changes: 1 addition & 1 deletion k8s/device-registry/values-stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ app:
replicaCount: 2
image:
repository: eu.gcr.io/airqo-250220/airqo-stage-device-registry-api
tag: stage-f5ce3fc9-1729339366
tag: stage-42690b37-1729375485
nameOverride: ''
fullnameOverride: ''
podAnnotations: {}
Expand Down
2 changes: 1 addition & 1 deletion k8s/exceedance/values-prod-airqo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ app:
configmap: env-exceedance-production
image:
repository: eu.gcr.io/airqo-250220/airqo-exceedance-job
tag: prod-d0d63dbd-1729340566
tag: prod-c73a134b-1729375524
nameOverride: ''
fullnameOverride: ''
2 changes: 1 addition & 1 deletion k8s/exceedance/values-prod-kcca.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ app:
configmap: env-exceedance-production
image:
repository: eu.gcr.io/airqo-250220/kcca-exceedance-job
tag: prod-d0d63dbd-1729340566
tag: prod-c73a134b-1729375524
nameOverride: ''
fullnameOverride: ''
2 changes: 1 addition & 1 deletion k8s/predict/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ images:
predictJob: eu.gcr.io/airqo-250220/airqo-predict-job
trainJob: eu.gcr.io/airqo-250220/airqo-train-job
predictPlaces: eu.gcr.io/airqo-250220/airqo-predict-places-air-quality
tag: prod-d0d63dbd-1729340566
tag: prod-c73a134b-1729375524
api:
name: airqo-prediction-api
label: prediction-api
Expand Down
2 changes: 1 addition & 1 deletion k8s/spatial/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ app:
replicaCount: 3
image:
repository: eu.gcr.io/airqo-250220/airqo-spatial-api
tag: prod-d0d63dbd-1729340566
tag: prod-c73a134b-1729375524
nameOverride: ''
fullnameOverride: ''
podAnnotations: {}
Expand Down
2 changes: 1 addition & 1 deletion k8s/workflows/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ images:
initContainer: eu.gcr.io/airqo-250220/airqo-workflows-xcom
redisContainer: eu.gcr.io/airqo-250220/airqo-redis
containers: eu.gcr.io/airqo-250220/airqo-workflows
tag: prod-d0d63dbd-1729340566
tag: prod-c73a134b-1729375524
nameOverride: ''
fullnameOverride: ''
podAnnotations: {}
Expand Down
57 changes: 57 additions & 0 deletions src/auth-service/middleware/test/ut_setDefaultTenant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
require("module-alias/register");
const { expect } = require("chai");
const sinon = require("sinon");
const setDefaultTenant = require("@middleware/setDefaultTenant");
const constants = require("@config/constants");

describe("setDefaultTenant Middleware", () => {
let req, res, next;

beforeEach(() => {
req = {
query: {},
};
res = {};
next = sinon.stub();
});

afterEach(() => {
sinon.restore(); // Restore the original functionality of stubbed methods
});

it("should set the default tenant if tenant is empty", () => {
// Set up the constant for testing
constants.DEFAULT_TENANT = "defaultTenant";

const middleware = setDefaultTenant;
middleware(req, res, next);

expect(req.query.tenant).to.equal("defaultTenant");
expect(next.calledOnce).to.be.true; // Ensure next() is called
});

it("should keep the existing tenant if provided", () => {
req.query.tenant = "customTenant";

const middleware = setDefaultTenant;
middleware(req, res, next);

expect(req.query.tenant).to.equal("customTenant");
expect(next.calledOnce).to.be.true; // Ensure next() is called
});

it("should use 'airqo' as the default tenant if no constant is defined", () => {
// Temporarily remove DEFAULT_TENANT for this test
const originalDefaultTenant = constants.DEFAULT_TENANT;
delete constants.DEFAULT_TENANT;

const middleware = setDefaultTenant;
middleware(req, res, next);

expect(req.query.tenant).to.equal("airqo");
expect(next.calledOnce).to.be.true; // Ensure next() is called

// Restore the original constant value after test
constants.DEFAULT_TENANT = originalDefaultTenant;
});
});
Loading

0 comments on commit ce887f9

Please sign in to comment.