Skip to content
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

[tests-only][full-ci]Setup keycloak group e2e tests #11887

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

amrita-shrestha
Copy link
Contributor

@amrita-shrestha amrita-shrestha commented Nov 12, 2024

Description

This PR covers :

  • upgrade keycloak version to 25.0.0
  • oCIS takes a maximum of 5 minutes to sync, which goes against the playwright timeout (see https://owncloud.dev/services/proxy/#claim-updates for detailed information). So, the keycloak group is created through a JSON file with oCIS realm creation
  • created separate feature file
  • does API request to store group list before hook if KEYCLOAK env set true
  • checked cases like group share, adding user to groups, renaming group created at keycloak, deleting oCIS groups
  • introduced dummyKeycloakGroupStore to store keycloak group

Note

  • avoid steps or test cases which need synchronization between oCIS and keycloak (5 min sync time) like keycloak group deletion (after hook avoid keycloak group deletion to avoid timeout problem)

Related Issue

Motivation and Context

How Has This Been Tested?

  • locally.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests
  • Documentation
  • Maintenance (e.g. dependency updates or tooling)

Open tasks:

  • ...

@amrita-shrestha amrita-shrestha changed the title [tests-only][full-ci]Setup keycloak group in CI [tests-only][full-ci]Setup keycloak group e2e tests Nov 14, 2024
Copy link

sonarcloud bot commented Nov 14, 2024

@@ -160,3 +160,13 @@ export const assignRole = async (admin: User, id: string, role: string): Promise
})
checkResponseStatus(response, 'Failed while assigning role to the user')
}

export const getGroup = async ({ admin }: { admin: User }) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export const getGroup = async ({ admin }: { admin: User }) => {
export const getGroups = async (admin: User) => {

Comment on lines +165 to +171
return (
await request({
method: 'GET',
path: join('graph', 'v1.0', 'groups'),
user: admin
})
).json()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return array of groups. not a full response

/*
store group created from keycloak on store
*/
const storeGroup = async (user: User, usersEnvironment) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const storeGroup = async (user: User, usersEnvironment) => {
const storeKeycloakGroups = async (user: User, usersEnvironment) => {

Comment on lines 8 to +11
federatedUserStore
} from '../store'
import { config } from '../../config'
import { dummyKeycloakGroupStore } from '../store/keycloak'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not?

Suggested change
federatedUserStore
} from '../store'
import { config } from '../../config'
import { dummyKeycloakGroupStore } from '../store/keycloak'
federatedUserStore,
dummyKeycloakGroupStore
} from '../store'
import { config } from '../../config'

@@ -41,6 +41,8 @@ import {
} from '../../support/api/keycloak'
import { closeSSEConnections } from '../../support/environment/sse'
import { setAccessAndRefreshToken } from '../../support/api/token'
import { dummyKeycloakGroupStore } from '../../support/store/keycloak'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be imported in the above import statement

Suggested change
import { dummyKeycloakGroupStore } from '../../support/store/keycloak'

Comment on lines +71 to +78
When "Admin" deletes the following groups using the batch actions
| group |
| security |
| finance |
Then "Admin" should not see the following groups
| group |
| security |
| finance |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need these ocis group steps? one should be enough if you insist

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to test keycloak integration doesn't affect oCIS side group

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants