-
Notifications
You must be signed in to change notification settings - Fork 2k
ci(iam): migrate to new CI #4007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -17,21 +17,17 @@ | |||||
| const {assert} = require('chai'); | ||||||
| const uuid = require('uuid'); | ||||||
| const cp = require('child_process'); | ||||||
| const {describe, it, before} = require('mocha'); | ||||||
|
Check failure on line 20 in iam/deny/test/deny.test.js
|
||||||
| const {PoliciesClient} = require('@google-cloud/iam').v2; | ||||||
| const iamClient = new PoliciesClient(); | ||||||
|
|
||||||
| const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); | ||||||
|
|
||||||
| describe('IAM deny samples', () => { | ||||||
| let projectId; | ||||||
| const {projectId} = process.env; | ||||||
| const policyId = `gcloud-test-policy-${uuid.v4().split('-')[0]}`; | ||||||
| const policyName = `policies/cloudresourcemanager.googleapis.com%2Fprojects%2F949737848314/denypolicies/${policyId}`; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Style Guide References
Suggested change
|
||||||
|
|
||||||
| before(async () => { | ||||||
| projectId = await iamClient.getProjectId(); | ||||||
| }); | ||||||
|
|
||||||
| it('should create IAM policy', async () => { | ||||||
| const output = execSync(`node createDenyPolicy ${projectId} ${policyId}`); | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a check to ensure that
process.env.projectIdis defined before using it. If it's not defined, the tests will fail in a confusing way. You can throw an error or use a default project ID for testing purposes. If you throw an error, make sure to fail fast, and provide a helpful message to the user.Style Guide References