-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dagit test to make sure Permission flags stay in sync (#7117)
* add perm test * generate permissions
- Loading branch information
Showing
8 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
js_modules/dagit/packages/core/src/app/Permissions.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import permissions from '../graphql/permissions.json'; | ||
|
||
import {EXPECTED_PERMISSIONS} from './Permissions'; | ||
|
||
describe('Permissions', () => { | ||
it('Client permissions match graphql permissions', () => { | ||
permissions.forEach(({permission}: {permission: any}) => { | ||
expect(permission in EXPECTED_PERMISSIONS).toBe(true); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
js_modules/dagit/packages/core/src/scripts/generatePermissions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {execSync} from 'child_process'; | ||
import {writeFileSync} from 'fs'; | ||
|
||
console.log('Downloading permissions...'); | ||
|
||
const TARGET_FILE = './src/graphql/permissions.json'; | ||
|
||
const result = execSync( | ||
`dagster-graphql --ephemeral-instance --empty-workspace -t 'query { permissions { permission } }'`, | ||
{cwd: '../../../../examples/docs_snippets/'}, | ||
).toString(); | ||
|
||
const permissionJson = JSON.parse(result).data.permissions; | ||
|
||
console.log('Generating permissions.json...'); | ||
|
||
writeFileSync(TARGET_FILE, JSON.stringify(permissionJson)); | ||
|
||
console.log('Done!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters