Skip to content

[Spike] Investigate how to improve unit test coverage for 'ctl' package #6570

Open
@TiberiuGC

Description

@TiberiuGC

Unit test coverage for the ctl package mostly consists of checking correct usage of the commands e.g. all required flags are specified, the command throws validation errors if incorrect flags or flags that shouldn't be combined are being provided, etc. (i.e. only validation related bits). While the ctl package is usually not doing much more than that, there are exceptions. E.g. the create iamserviceaccount command sets up a filter to decide whether to override or not existing service accounts.

https://github.com/weaveworks/eksctl/blob/27219282eeb35e2062ba8440dbf724cdd034099d/pkg/ctl/create/iamserviceaccount.go#L113-L118

Our tests should ideally cover such pieces of functionality as-well. Most of this logic however is being written at some point after initialising the cluster provider.

https://github.com/weaveworks/eksctl/blob/27219282eeb35e2062ba8440dbf724cdd034099d/pkg/ctl/create/iamserviceaccount.go#L83-L86

We should investigate if there's a reasonable way to mock the provider and then increase test coverage, separately, for each relevant command.

As part of this spike we should also determine if there still are commands completely missing unit test coverage.

Timebox: 1-2 days

Metadata

Metadata

Assignees

Labels

area/tech-debtLeftover improvements in code, testing and buildingpriority/important-longtermImportant over the long term, but may not be currently staffed and/or may require multiple releases

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions