Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Support for verification of the Helm charts using BDD approach #100

Merged
merged 67 commits into from
Mar 25, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
8c779cc
docs: update docs
mdelapenya Mar 11, 2020
18fd3b8
chore: move Execute to a separate package to be exposed and used in t…
mdelapenya Mar 11, 2020
235bae6
chore: move Which method to the shell package
mdelapenya Mar 11, 2020
9519ef0
chore: improve shell execution returning the underlying error
mdelapenya Mar 12, 2020
cfb6c80
chore: move check installed software to shell package
mdelapenya Mar 12, 2020
314bb72
feat: support for verifying helm charts
mdelapenya Mar 12, 2020
f151fce
fix: return install error instead
mdelapenya Mar 12, 2020
66879e6
feat: add step for the getting the deployment resource
mdelapenya Mar 12, 2020
85db63a
feat: add step for the kube stats deployment
mdelapenya Mar 12, 2020
56022ad
chore: install test dependencies in the build agents
mdelapenya Mar 12, 2020
557f893
chore: improve logs and variable names
mdelapenya Mar 12, 2020
1a4528f
feat: add step for getting a ConfigMap inlcuding a content
mdelapenya Mar 12, 2020
88509e7
feat: add step for RBAC resources
mdelapenya Mar 12, 2020
4316ed6
feat: use minikube to create/destroy the cluster for tests
mdelapenya Mar 12, 2020
a8a2881
chore: rename method
mdelapenya Mar 12, 2020
a107bed
chore: reorder methods alphabetically
mdelapenya Mar 12, 2020
936dcc8
feat: support for different versions of the helm chart
mdelapenya Mar 12, 2020
cd6e1b9
chore: convert checkInstalledTools into a step
mdelapenya Mar 12, 2020
6b5e4fd
chore: move tools step out of the feature file
mdelapenya Mar 12, 2020
4196c39
chore: fix precommit errors
mdelapenya Mar 12, 2020
d6fb437
feat: check cluster state in a step
mdelapenya Mar 12, 2020
6d569d9
chore: abstract Helm tool in the services manager
mdelapenya Mar 13, 2020
7335823
chore: extract exec helm method
mdelapenya Mar 13, 2020
bf213a6
wip: support for helm 2.16.3
mdelapenya Mar 13, 2020
78ecbee
chore: use kind instead of minikube to provision the cluster
mdelapenya Mar 16, 2020
cd76b2a
feat: support for Helm 2.x, installing Tiller in the cluster
mdelapenya Mar 16, 2020
e57b1e1
ci: install test dependencies on CI
mdelapenya Mar 16, 2020
d3b2891
ci: run helm tests as smoke test
mdelapenya Mar 16, 2020
b8cbb93
ci: do not fail version commands
mdelapenya Mar 16, 2020
2dd3613
feat: support for Filebeat Helm verification
mdelapenya Mar 18, 2020
56f2fad
feat: support changing Kubernetes version with an Env Var
mdelapenya Mar 18, 2020
46ae91c
chore: print tools' client version
mdelapenya Mar 18, 2020
d1e9fa7
fix: use Helm 2.x
mdelapenya Mar 18, 2020
fcc5b2a
fix: check error when deleting a chart
mdelapenya Mar 18, 2020
503146f
chore: exclude func from misleading lint error
mdelapenya Mar 18, 2020
a08ecc4
ci: support the pipeline to override helm and kubernetes versions
mdelapenya Mar 18, 2020
7f22933
fix: use Jenkins variables in the script
mdelapenya Mar 18, 2020
fb9b444
fix: typo in parameter help
mdelapenya Mar 18, 2020
e884b60
feat: support changing log level
mdelapenya Mar 18, 2020
a1af0e9
chore: rename step to use key instead of content
mdelapenya Mar 20, 2020
dfcf5f4
feat: APM Server Helm Chart test
kuisathaverat Mar 20, 2020
f8face4
feat: install elasticsearch helm chart right before the test suite is…
mdelapenya Mar 18, 2020
cc7dee8
feat: support checking volumes
mdelapenya Mar 20, 2020
9301745
chore: refactor
kuisathaverat Mar 20, 2020
a7a0570
chore: refactor
kuisathaverat Mar 20, 2020
3c5fbbd
fix: unrelated change
kuisathaverat Mar 20, 2020
f4d15fd
chore: refactor
kuisathaverat Mar 20, 2020
3e228e5
fix: unrelated change
kuisathaverat Mar 20, 2020
8099b26
chore: refactor
kuisathaverat Mar 20, 2020
6c84417
Merge branch '99-helm-charts-verification' of https://github.com/kuis…
mdelapenya Mar 20, 2020
f46e49a
chore: rename methods for clarity
mdelapenya Mar 20, 2020
bdb9d8c
chore: reorder methods alphabetically
mdelapenya Mar 20, 2020
3ccad71
chore: apply formatter in strings
mdelapenya Mar 20, 2020
0508bd3
feat: add checks for RollingUpdate strategies
mdelapenya Mar 23, 2020
178d8bc
fix: get resource name for daemonsets and deployments
mdelapenya Mar 23, 2020
48ce587
chore: exclude variable from lint
mdelapenya Mar 23, 2020
bd46264
chore: forgotten auto format
mdelapenya Mar 23, 2020
648870e
chore: reuse method
mdelapenya Mar 23, 2020
d1702b6
fix: remove quotes from go-template
mdelapenya Mar 23, 2020
a849108
chore: extract strings to an Enum
mdelapenya Mar 23, 2020
e5e6c80
chore: rename import package to k8s
mdelapenya Mar 23, 2020
ed9e348
chore: add debug log when installing chart
mdelapenya Mar 23, 2020
9274c90
feat: support for checking resource limits in the cluster
mdelapenya Mar 23, 2020
39d0e59
fix: apm-server pod name is not duplicating name
mdelapenya Mar 23, 2020
3adeff6
chore: add unit tests for git code
mdelapenya Mar 24, 2020
ba1e5d5
chore: remove git dead code
mdelapenya Mar 24, 2020
8d98945
chore: remove more dead code
mdelapenya Mar 25, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions e2e/features/apm/helm.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Scenario: The APM Server chart will create recommended K8S resources
And a "ServiceAccount" resource manages RBAC
And a "ClusterRole" resource manages RBAC
And a "ClusterRoleBinding" resource manages RBAC
And the "RollingUpdate" strategy can be used for "Deployment" during updates
1 change: 1 addition & 0 deletions e2e/features/filebeat/helm.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ Scenario: The Filebeat chart will create recommended K8S resources
And a "ServiceAccount" resource manages RBAC
And a "ClusterRole" resource manages RBAC
And a "ClusterRoleBinding" resource manages RBAC
And the "RollingUpdate" strategy can be used during updates
And the "filebeat-config" volume is mounted at "/usr/share/filebeat/filebeat.yml" with subpath "filebeat.yml"
And the "data" volume is mounted at "/usr/share/filebeat/data" with no subpath
2 changes: 2 additions & 0 deletions e2e/features/metricbeat/helm.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Scenario: The Metricbeat chart will create recommended K8S resources
And a "ServiceAccount" resource manages RBAC
And a "ClusterRole" resource manages RBAC
And a "ClusterRoleBinding" resource manages RBAC
And the "RollingUpdate" strategy can be used for "Deployment" during updates
And the "RollingUpdate" strategy can be used for "Daemonset" during updates
And the "data" volume is mounted at "/usr/share/metricbeat/data" with no subpath
And the "varlibdockercontainers" volume is mounted at "/var/lib/docker/containers" with no subpath
And the "varrundockersock" volume is mounted at "/var/run/docker.sock" with no subpath
Expand Down
49 changes: 49 additions & 0 deletions e2e/helm_charts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,53 @@ func (ts *HelmChartTestSuite) resourceWillManageAdditionalPodsForMetricsets(reso
return nil
}

func (ts *HelmChartTestSuite) strategyCanBeUsedDuringUpdates(strategy string) error {
output, err := kubectl.Run("get", "ds/"+ts.Name+"-"+ts.Name, "-o", `go-template='{{.spec.updateStrategy.type}}'`)
mdelapenya marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return err
}

output = strings.ReplaceAll(output, "'", "")
mdelapenya marked this conversation as resolved.
Show resolved Hide resolved
if output != strategy {
return fmt.Errorf("There is no %s strategy to be used on updates. Actual: %s", strategy, output)
}

log.WithFields(log.Fields{
"strategy": strategy,
"chart": ts.Name,
}).Debug("The strategy can be used during updates")

return nil
}

func (ts *HelmChartTestSuite) strategyCanBeUsedForResourceDuringUpdates(strategy string, resource string) error {
lowerResource := strings.ToLower(resource)
strategyKey := "strategy"
name := ts.Name + "-" + ts.Name + "-metrics"

if lowerResource == "daemonset" {
strategyKey = "updateStrategy"
name = ts.Name + "-" + ts.Name
}

output, err := kubectl.Run("get", lowerResource, name, "-o", `go-template='{{.spec.`+strategyKey+`.type}}'`)
mdelapenya marked this conversation as resolved.
Show resolved Hide resolved
output = strings.ReplaceAll(output, "'", "")
if err != nil {
return err
}
if output != strategy {
return fmt.Errorf("There is no %s strategy to be used for %s on updates. Actual: %s", strategy, resource, output)
}

log.WithFields(log.Fields{
"strategy": strategy,
"resource": resource,
"name": name,
}).Debug("The strategy can be used for resource during updates")

return nil
}

func (ts *HelmChartTestSuite) volumeMountedWithNoSubpath(name string, mountPath string) error {
return ts.volumeMountedWithSubpath(name, mountPath, "")
}
Expand Down Expand Up @@ -428,6 +475,8 @@ func HelmChartFeatureContext(s *godog.Suite) {
s.Step(`^a "([^"]*)" resource manages RBAC$`, testSuite.aResourceManagesRBAC)
s.Step(`^the "([^"]*)" volume is mounted at "([^"]*)" with subpath "([^"]*)"$`, testSuite.volumeMountedWithSubpath)
s.Step(`^the "([^"]*)" volume is mounted at "([^"]*)" with no subpath$`, testSuite.volumeMountedWithNoSubpath)
s.Step(`^the "([^"]*)" strategy can be used during updates$`, testSuite.strategyCanBeUsedDuringUpdates)
s.Step(`^the "([^"]*)" strategy can be used for "([^"]*)" during updates$`, testSuite.strategyCanBeUsedForResourceDuringUpdates)

s.Step(`^a "([^"]*)" which will manage the pods$`, testSuite.aResourceWillManagePods)
s.Step(`^a "([^"]*)" which will expose the pods as network services internal to the k8s cluster$`, testSuite.aResourceWillExposePods)
Expand Down