Skip to content

Commit

Permalink
Merge pull request #40 from galal-hussein/more_tests
Browse files Browse the repository at this point in the history
More helm tests and upgrade klipper
  • Loading branch information
erikwilson authored Apr 14, 2020
2 parents 809a41e + 474a032 commit e7f3c6b
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/helm/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type Controller struct {
}

const (
image = "rancher/klipper-helm:v0.2.4"
image = "rancher/klipper-helm:v0.2.5"
Label = "helmcharts.helm.cattle.io/chart"
CRDName = "helmcharts.helm.cattle.io"
Name = "helm-controller"
Expand Down
4 changes: 2 additions & 2 deletions test/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ func (f *Framework) ListHelmCharts(labelSelector, namespace string) (*helmapiv1.
// WaitForChartApp will check the for pods created by the chart
func (f *Framework) WaitForChartApp(chart *helmapiv1.HelmChart, appName string, timeout time.Duration, count int) (pods []corev1.Pod, err error) {
labelSelector := labels.SelectorFromSet(labels.Set{
"app": appName,
"heritage": "Helm",
"app": appName,
"release": chart.Name,
})

return pods, wait.Poll(5*time.Second, timeout, func() (bool, error) {
Expand Down
45 changes: 45 additions & 0 deletions test/suite/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,51 @@ var _ = Describe("Helm Tests", func() {
})
})

Context("When a helm V3 chart version is updated with values", func() {
var (
err error
chart *helmapiv1.HelmChart
secrets []corev1.Secret
pods []corev1.Pod
)
BeforeEach(func() {
chart = framework.NewHelmChart("traefik-update-example-values",
"stable/traefik",
"1.86.1",
"v3",
map[string]intstr.IntOrString{
"rbac.enabled": {
Type: intstr.String,
StrVal: "true",
},
"ssl.enabled": {
Type: intstr.String,
StrVal: "true",
},
})
chart, err = framework.CreateHelmChart(chart, framework.Namespace)
Expect(err).ToNot(HaveOccurred())

labelSelector := labels.SelectorFromSet(labels.Set{
"owner": "helm",
"name": chart.Name,
})
secrets, err = framework.WaitForRelease(chart, labelSelector, 120*time.Second, 1)
Expect(err).ToNot(HaveOccurred())
Expect(secrets).To(HaveLen(1))

chart, err = framework.GetHelmChart("traefik-update-example-values", framework.Namespace)
chart.Spec.Set["replicas"] = intstr.FromString("3")
chart, err = framework.UpdateHelmChart(chart, framework.Namespace)
Expect(err).ToNot(HaveOccurred())
pods, err = framework.WaitForChartApp(chart, "traefik", 120*time.Second, 3)
Expect(err).ToNot(HaveOccurred())
})
It("Should upgrade the release successfully", func() {
Expect(len(pods)).To(BeEquivalentTo(3))
})
})

Context("When a helm V2 chart is created", func() {
var (
err error
Expand Down

0 comments on commit e7f3c6b

Please sign in to comment.