gchq / gchq/sleeper

Clarify distinction between base & admin system test drivers

Open
#7,238 0 comments 0 reactions 0 assignees View on GitHub
system-test-module
Dominant language
Java
Stars
107
Forks
29
Avg merge
19h 46m
Merged PRs (30d)
141

Description

We'd like to refactor the system test code to make it clearer why there are two separate SystemTestDrivers objects that are used.

#### The two drivers

There's SystemTestDeploymentContext.drivers, which comes through to SleeperDsl.baseDrivers. There's also DeployedSleeperInstance.instanceAdminDrivers. In the places where these are used, it's not always clear which is which, and it's not easy to find a single place that clarifies the distinction between them.

You can find out what the admin drivers are by looking in DeployedSleeperInstance.loadOrDeployAtFirstConnect, where it uses AssumeAdminRoleDriver to assume the instance admin role, and create a new set of drivers in DeployedSleeperInstance.instanceAdminDrivers.

By contrast, the base drivers are set when the SystemTestDeploymentContext is first created, e.g. in AwsSleeperSystemTestExtension.

#### Intended use of instance admin role

We use the instance admin role whenever we can in order to exercise it in tests, and in order to move towards a situation where we have all the relevant roles in the system specified to the point where we no longer need to use a permissive admin role anywhere.

#### Changes

One approach to this might be to refactor how the instance admin drivers are retrieved in the DSL classes, e.g. in SleeperDsl. It should be clear that this might cause a problem with permissions, and you should only use the instance admin drivers if the instance admin role has the permissions you need.

Contributor guide

Open the contributing guide

Research direction

Start with SleeperDsl, SystemTestDeploymentContext.drivers, and DeployedSleeperInstance.loadOrDeployAtFirstConnect, then compare how baseDrivers and instanceAdminDrivers are retrieved. Trace AwsSleeperSystemTestExtension to see where base drivers are created. Done means the two driver sets have a clear distinction in the DSL and permissions are preserved by using instance admin drivers only where their role allows it.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.