Skip to content

Commit

Permalink
Merge pull request #167 from celo-org/soloseng/update-signer-e2e-test…
Browse files Browse the repository at this point in the history
…-script

Update ODIS Signer e2e Test Script
  • Loading branch information
soloseng authored Nov 16, 2023
2 parents 65a5fc0 + 1251559 commit 6a96828
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-lies-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@celo/phone-number-privacy-signer': patch
---

Updated the e2e test script.
5 changes: 5 additions & 0 deletions .changeset/red-ravens-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@celo/phone-number-privacy-monitor': patch
---

Added `ts-node` to monitor package
3 changes: 2 additions & 1 deletion apps/monitor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"devDependencies": {
"firebase-functions-test": "^3.1.0",
"firebase-tools": "9.20.0",
"jest": "^29.7.0"
"jest": "^29.7.0",
"ts-node": "^10.9.1"
},
"engines": {
"node": ">=14"
Expand Down
3 changes: 2 additions & 1 deletion apps/signer/.env
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ ALFAJORES_ODIS_BLOCKCHAIN_PROVIDER=https://alfajores-forno.celo-testnet.org
MAINNET_ODIS_BLOCKCHAIN_PROVIDER=https://forno.celo.org
ODIS_DOMAINS_TEST_KEY_VERSION=1
ODIS_PNP_TEST_KEY_VERSION=1
DEPLOYED_SIGNER_SERVICE_VERSION=3.0.1
# DEPLOYED_SIGNER_SERVICE_VERSION=3.1.1

# PUBKEYS
STAGING_DOMAINS_PUBKEY=7FsWGsFnmVvRfMDpzz95Np76wf/1sPaK0Og9yiB+P8QbjiC8FV67NBans9hzZEkBaQMhiapzgMR6CkZIZPvgwQboAxl65JWRZecGe5V3XO4sdKeNemdAZ2TzQuWkuZoA
ALFAJORES_DOMAINS_PUBKEY=+ZrxyPvLChWUX/DyPw6TuGwQH0glDJEbSrSxUARyP5PuqYyP/U4WZTV1e0bAUioBZ6QCJMiLpDwTaFvy8VnmM5RBbLQUMrMg5p4+CBCqj6HhsMfcyUj8V0LyuNdStlCB
Expand Down
18 changes: 9 additions & 9 deletions apps/signer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
"test:integration:debugdb": "VERBOSE_DB_LOGGING=true jest --runInBand test/integration",
"test:e2e": "jest --runInBand test/end-to-end --testPathIgnorePatterns test/end-to-end/disabled-apis.test.ts",
"test:e2e:disabledapis": "jest --runInBand test/end-to-end/disabled-apis.test.ts",
"test:e2e:staging:0": "CONTEXT_NAME=staging ODIS_SIGNER_SERVICE_URL=https://staging-pgpnp-signer0.azurefd.net yarn test:e2e",
"test:e2e:staging:1": "CONTEXT_NAME=staging ODIS_SIGNER_SERVICE_URL=https://staging-pgpnp-signer1.azurefd.net yarn test:e2e",
"test:e2e:staging:2": "CONTEXT_NAME=staging ODIS_SIGNER_SERVICE_URL=https://staging-pgpnp-signer2.azurefd.net yarn test:e2e",
"test:e2e:alfajores:1": "CONTEXT_NAME=alfajores ODIS_SIGNER_SERVICE_URL=https://odis-alfajores-signer-1-b.azurefd.net yarn test:e2e",
"test:e2e:alfajores:2": "CONTEXT_NAME=alfajores ODIS_SIGNER_SERVICE_URL=https://odis-alfajores-signer2.azurefd.net yarn test:e2e",
"test:e2e:alfajores:3": "CONTEXT_NAME=alfajores ODIS_SIGNER_SERVICE_URL=https://odis-alfajores-signer3.azurefd.net yarn test:e2e",
"test:e2e:mainnet:brazilsouth": "CONTEXT_NAME=mainnet ODIS_SIGNER_SERVICE_URL=https://mainnet-pgpnp-brazilsouth.azurefd.net yarn test:e2e",
"test:e2e:mainnet:eastasia": "CONTEXT_NAME=mainnet ODIS_SIGNER_SERVICE_URL=https://mainnet-pgpnp-eastasia.azurefd.net yarn test:e2e",
"test:e2e:staging:0": "CONTEXT_NAME=staging ODIS_SIGNER_SERVICE_URL=https://odis-signer0-staging.integration-tests.celo-networks-dev.org yarn test:e2e",
"test:e2e:staging:1": "CONTEXT_NAME=staging ODIS_SIGNER_SERVICE_URL=https://odis-signer1-staging.integration-tests.celo-networks-dev.org yarn test:e2e",
"test:e2e:staging:2": "CONTEXT_NAME=staging ODIS_SIGNER_SERVICE_URL=https://odis-signer2-staging.integration-tests.celo-networks-dev.org yarn test:e2e",
"test:e2e:alfajores:0": "CONTEXT_NAME=alfajores ODIS_SIGNER_SERVICE_URL=https://odis-signer0-alfajores.alfajores.celo-testnet.org yarn test:e2e",
"test:e2e:alfajores:1": "CONTEXT_NAME=alfajores ODIS_SIGNER_SERVICE_URL=https://odis-signer1-alfajores.alfajores.celo-testnet.org yarn test:e2e",
"test:e2e:alfajores:2": "CONTEXT_NAME=alfajores ODIS_SIGNER_SERVICE_URL=https://odis-signer2-alfajores.alfajores.celo-testnet.org yarn test:e2e",
"test:e2e:mainnet:0": "CONTEXT_NAME=mainnet ODIS_SIGNER_SERVICE_URL=https://odis-signer0-mainnet.rc1-europe-west1.celo-testnet.org yarn test:e2e",
"test:e2e:mainnet:1": "CONTEXT_NAME=mainnet ODIS_SIGNER_SERVICE_URL=https://odis-signer1-mainnet.rc1-europe-west1.celo-testnet.org yarn test:e2e",
"test:signer:mainnet": "MAINNET_ODIS_BLOCKCHAIN_PROVIDER=https://alfajores-forno.celo-testnet.org CONTEXT_NAME=mainnet yarn jest test/end-to-end -t='\\[Signer configuration test\\]'",
"db:migrate": "ts-node scripts/run-migrations.ts",
"db:migrate:make": "knex --migrations-directory ./src/common/database/migrations migrate:make -x ts",
Expand Down Expand Up @@ -81,7 +81,7 @@
"sqlite3": "^5.0.8",
"supertest": "^6.2.3",
"ts-mockito": "^2.6.1",
"ts-node": "^8.3.0",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
},
"engines": {
Expand Down
5 changes: 4 additions & 1 deletion apps/signer/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import BigNumber from 'bignumber.js'
require('dotenv').config()

export function getSignerVersion(): string {
return process.env.npm_package_version ?? '0.0.0'
return (
process.env.DEPLOYED_SIGNER_SERVICE_VERSION ?? require('../package.json').version ?? '0.0.0'
)
}
export const DEV_MODE = process.env.NODE_ENV !== 'production'
export const VERBOSE_DB_LOGGING = toBool(process.env.VERBOSE_DB_LOGGING, false)
Expand Down Expand Up @@ -102,6 +104,7 @@ export interface SignerConfig {
}

const env = process.env as any

export const config: SignerConfig = {
serviceName: env.SERVICE_NAME ?? 'odis-signer',
server: {
Expand Down
4 changes: 2 additions & 2 deletions apps/signer/test/end-to-end/disabled-apis.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from '@celo/phone-number-privacy-common'
import { defined, noBool, noNumber, noString } from '@celo/utils/lib/sign-typed-data-utils'
import { LocalWallet } from '@celo/wallet-local'
import 'isomorphic-fetch'
import { getSignerVersion } from '../../src/config'
require('dotenv').config()

const { ACCOUNT_ADDRESS1, BLINDED_PHONE_NUMBER, PRIVATE_KEY1 } = TestUtils.Values
Expand All @@ -30,7 +30,7 @@ const ODIS_SIGNER = process.env.ODIS_SIGNER_SERVICE_URL

jest.setTimeout(30000)

const expectedVersion = process.env.DEPLOYED_SIGNER_SERVICE_VERSION!
const expectedVersion = getSignerVersion()

// These tests should be run when the individual APIs are disabled.
// When run against enabled APIs, they should fail.
Expand Down
4 changes: 2 additions & 2 deletions apps/signer/test/end-to-end/domain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ import {
import { DomainRequest } from '@celo/phone-number-privacy-common/src'
import { defined, noBool, noNumber, noString } from '@celo/utils/lib/sign-typed-data-utils'
import { LocalWallet } from '@celo/wallet-local'
import 'isomorphic-fetch'
import { getSignerVersion } from '../../src/config'
import { getTestParamsForContext } from './utils'
const { ACCOUNT_ADDRESS1, PRIVATE_KEY1 } = TestUtils.Values

require('dotenv').config()

jest.setTimeout(60000)

const expectedVersion = process.env.DEPLOYED_SIGNER_SERVICE_VERSION!
const expectedVersion = getSignerVersion()

const ODIS_SIGNER_URL = process.env.ODIS_SIGNER_SERVICE_URL

Expand Down
5 changes: 2 additions & 3 deletions apps/signer/test/end-to-end/pnp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import {
} from '@celo/phone-number-privacy-common'
import threshold_bls from 'blind-threshold-bls'
import { randomBytes } from 'crypto'
import 'isomorphic-fetch'
import { config } from '../../src/config'
import { config, getSignerVersion } from '../../src/config'
import { getBlindedPhoneNumber, getTestParamsForContext } from './utils'

require('dotenv').config()
Expand All @@ -43,7 +42,7 @@ kit.addAccount(PRIVATE_KEY3)

jest.setTimeout(60000)

const expectedVersion = process.env.DEPLOYED_SIGNER_SERVICE_VERSION!
const expectedVersion = getSignerVersion()

describe(`Running against service deployed at ${ODIS_SIGNER_URL}`, () => {
const singleQueryCost = config.quota.queryPriceInCUSD.times(1e18).toString()
Expand Down
2 changes: 1 addition & 1 deletion docs/kubernetes-deployment/signer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ODIS signer is deployed in the following clusters:
- URL: `http://odis-signer0-alfajores.odis-signer0-alfajores:3000`. :warning: This is a URL internal to the cluster (i.e. not accessible from outside)!!
- URL external: `https://odis-signer0-alfajores.alfajores.celo-testnet.org`.
- Signer1 in namespace `odis-signer1-alfajores` with this [`values-signer1-alfajores.yaml` file](./values/alfajores/values-signer1-alfajores.yaml).
- URL: `http://odis-signer1-staging.odis-signer1-staging:3000`. :warning: This is a URL internal to the cluster (i.e. not accessible from outside)!!
- URL: `http://odis-signer1-alfajores.odis-signer1-alfajores:3000`. :warning: This is a URL internal to the cluster (i.e. not accessible from outside)!!
- URL external: `https://odis-signer1-alfajores.alfajores.celo-testnet.org`.
- Signer2 in namespace `odis-signer2-alfajores` with this [`values-signer2-alfajores.yaml` file](./values/alfajores/values-signer2-alfajores.yaml).
- URL: `http://odis-signer2-alfajores.odis-signer2-alfajores:3000`. :warning: This is a URL internal to the cluster (i.e. not accessible from outside)!!
Expand Down
5 changes: 3 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1989,6 +1989,7 @@ __metadata:
firebase-functions-test: "npm:^3.1.0"
firebase-tools: "npm:9.20.0"
jest: "npm:^29.7.0"
ts-node: "npm:^10.9.1"
yargs: "npm:^14.0.0"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -2038,7 +2039,7 @@ __metadata:
sqlite3: "npm:^5.0.8"
supertest: "npm:^6.2.3"
ts-mockito: "npm:^2.6.1"
ts-node: "npm:^8.3.0"
ts-node: "npm:^10.9.1"
typescript: "npm:^5.2.2"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -21580,7 +21581,7 @@ __metadata:
languageName: node
linkType: hard

"ts-node@npm:^8.3.0, ts-node@npm:^8.4.1":
"ts-node@npm:^8.4.1":
version: 8.10.2
resolution: "ts-node@npm:8.10.2"
dependencies:
Expand Down

0 comments on commit 6a96828

Please sign in to comment.