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

(feat): Add test cases for layer.ShouldProcess() #17

Merged
merged 1 commit into from
May 25, 2024

Conversation

lasith-kg
Copy link
Collaborator

@lasith-kg lasith-kg commented May 25, 2024

When adding lvm support to ebs-bootstrap, I realised that all layers were being invoked, even if the relevant flag for a layer was disabled across all devices. For example, we were querying for the sizes of all block devices and their file systems, even if the resize flag was disabled across all devices.

This was not a huge issue until we added lvm. Suddenly the LVM layers were being invoked and attempting to query the system with utilities like lvs and pvs. We can not reasonably expect that these tools will be pre-installed on the operating system.

Therefore I expanded the layer interface by adding a ShouldProcess(c *config.Config) method. This method would assess the config and determine whether the layer should be invoked. This brings performance gains as now the tool can avoid the invocation of layers that are not relevant to the consumer.

Here are test cases for this new layer.ShouldProcess() method

@lasith-kg lasith-kg enabled auto-merge May 25, 2024 04:34
@lasith-kg lasith-kg disabled auto-merge May 25, 2024 05:01
@lasith-kg lasith-kg merged commit 2370a1e into main May 25, 2024
4 checks passed
@lasith-kg lasith-kg deleted the feature/layer-should-process-test-cases branch May 25, 2024 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant