st-tech / gatling-operator

Automating distributed Gatling load testing using Kubernetes operator
MIT License
70 stars 19 forks source link

Refactor Providers: CloudStorageProvider and NotificationServiceProvider #43

Closed yokawasa closed 2 years ago

yokawasa commented 2 years ago

Description

I've made the following refactoring(s)

CloudStorageProvider

For the future extensibility, I separated provider specific codes from commands.go and gatling_controller.go, and made it access via unified interface like this:

provider := "aws"
p := cloudstorages.GetProvider(provider)
if p != nil {
  res := (*p).GetXXXX
  ...
}

NotificationServiceProvider

For the future extensibility, I separated provider specific codes from commands.go and gatling_controller.go, and made it access via unified interface like this:

provider := "slack"
p := notificationservices.GetProvider(provider)
if p != nil {
  err := (*p).Notify(gatlingName, reportURL, secretData)
  ...
}

Utils

Add util functions in a separate package named utils, not controllers

Others: Gatling Controller and Relevant test codes

Tests

Here is test coverages of gatling operator codes

make test

?       github.com/st-tech/gatling-operator     [no test files]
?       github.com/st-tech/gatling-operator/api/v1alpha1        [no test files]
ok      github.com/st-tech/gatling-operator/controllers 8.643s  coverage: 33.0% of statements
ok      github.com/st-tech/gatling-operator/controllers/cloudstorages   0.281s  coverage: 100.0% of statements
ok      github.com/st-tech/gatling-operator/controllers/notificationservices    0.487s  coverage: 34.6% of statements
?       github.com/st-tech/gatling-operator/controllers/utils   [no test files]

Among them (above), newly added codes are CloudStorageProvider and NotficationServiceProviders.

Regarding the test for NotificationServiceProvider, I confirmed that Slack notification message was sent as expected in my testing environments to check the rest of statements that aren't covered with the test code.

yokawasa commented 2 years ago

@tmrekk121 any update on your review?

yokawasa commented 2 years ago

@kayamin based upon your suggestion, I fixed message arg for gingko it func as well https://github.com/st-tech/gatling-operator/pull/43/commits/bcaab13980d458ba905337c8a9301d294eb7e311

yokawasa commented 2 years ago

@tmrekk121 @kayamin thanks a lot for the review. I'm merging the PR