Skip to content

Commit

Permalink
Fix e2e tests (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
samteb authored Feb 19, 2024
1 parent 1f687f9 commit 0cf7c29
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/authz_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions apps/authz/src/app/__test__/e2e/admin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions apps/authz/src/app/opa/opa.service.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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 }
}
Expand Down

0 comments on commit 0cf7c29

Please sign in to comment.