diff --git a/.github/workflows/authz_ci.yml b/.github/workflows/authz_ci.yml index eb38b20d2..c112022ac 100644 --- a/.github/workflows/authz_ci.yml +++ b/.github/workflows/authz_ci.yml @@ -56,10 +56,10 @@ jobs: run: | make authz/test/integration - # - name: Test E2E - # shell: bash - # run: | - # make orchestration/test/e2e + - name: Test E2E + shell: bash + run: | + make authz/test/e2e - name: Send Slack notification on failure if: failure() && github.ref == 'refs/heads/main' diff --git a/apps/authz/src/app/__test__/e2e/admin.spec.ts b/apps/authz/src/app/__test__/e2e/admin.spec.ts index 2d2435685..bf6729923 100644 --- a/apps/authz/src/app/__test__/e2e/admin.spec.ts +++ b/apps/authz/src/app/__test__/e2e/admin.spec.ts @@ -172,6 +172,7 @@ describe('Admin Endpoints', () => { criterion: Criterion.CHECK_SPENDING_LIMIT, args: { limit: '1000000000000000000', + operator: ValueOperators.GREATER_THAN, timeWindow: { type: TimeWindow.ROLLING, value: 43200 diff --git a/apps/authz/src/app/opa/opa.service.ts b/apps/authz/src/app/opa/opa.service.ts index cfe11d1ca..5b45fce1d 100644 --- a/apps/authz/src/app/opa/opa.service.ts +++ b/apps/authz/src/app/opa/opa.service.ts @@ -1,7 +1,6 @@ import { Injectable, Logger, OnApplicationBootstrap } from '@nestjs/common' import { loadPolicy } from '@open-policy-agent/opa-wasm' -import { execSync } from 'child_process' -import { readFileSync, writeFileSync } from 'fs' +import { mkdirSync, readFileSync, writeFileSync } from 'fs' import Handlebars from 'handlebars' import { indexBy } from 'lodash/fp' import { ORGANIZATION } from 'packages/authz-shared/src/lib/dev.fixture' @@ -65,13 +64,13 @@ export class OpaService implements OnApplicationBootstrap { const fileId = uuid() - writeFileSync(`./apps/authz/src/opa/rego/generated/${fileId}.rego`, regoContent, 'utf-8') + const basePath = './apps/authz/src/opa/rego/generated' - this.logger.log('Policy .rego file generated successfully.') + mkdirSync(basePath, { recursive: true }) - execSync('make authz/rego/build') + writeFileSync(`${basePath}/${fileId}.rego`, regoContent, 'utf-8') - this.logger.log('Policies .wasm file build successfully.') + this.logger.log('Policy .rego file generated successfully.') return { fileId, policies } }