Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
errordeveloper committed Jun 13, 2019
1 parent 997eb59 commit f114cde
Showing 1 changed file with 35 additions and 33 deletions.
68 changes: 35 additions & 33 deletions pkg/addons/default/coredns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes/fake"
)

var _ = Describe("default addons - coredns", func() {
Describe("can update from kubedns to coredns add-on", func() {
Describe("[1.10 –> 1.11] can update from kube-dns to coredns", func() {
var (
rawClient *testutils.FakeRawClient
ct *testutils.CollectionTracker
Expand Down Expand Up @@ -63,7 +62,7 @@ var _ = Describe("default addons - coredns", func() {
Expect(err).ToNot(HaveOccurred())

// test client doesn't support watching, and we would have to create some pods, so we set nil timeout
_, err = InstallCoreDNS(rawClient, "eu-west-1", nil, false)
_, err = InstallCoreDNS(rawClient, "eu-west-1", "1.11.x", nil, false)
Expect(err).ToNot(HaveOccurred())

updateReqs := []string{
Expand Down Expand Up @@ -94,7 +93,7 @@ var _ = Describe("default addons - coredns", func() {

Expect(svcNew.Spec.ClusterIP).To(Equal(svcOld.Spec.ClusterIP))

coreDNS, err := rawClient.ClientSet().ExtensionsV1beta1().Deployments(metav1.NamespaceSystem).Get(CoreDNS, metav1.GetOptions{})
coreDNS, err := rawClient.ClientSet().AppsV1().Deployments(metav1.NamespaceSystem).Get(CoreDNS, metav1.GetOptions{})
Expect(err).ToNot(HaveOccurred())
Expect(coreDNS.Spec.Replicas).ToNot(BeNil())
Expect(*coreDNS.Spec.Replicas == 2).To(BeTrue())
Expand All @@ -106,41 +105,44 @@ var _ = Describe("default addons - coredns", func() {

})

Describe("can update coredns", func() {
var (
clientSet *fake.Clientset
)
/*
Describe("[1.11 –> 1.12] can update coredns", func() {
var (
rawClient *testutils.FakeRawClient
ct *testutils.CollectionTracker
)
check := func(imageTag string) {
coreDNS, err := clientSet.AppsV1().Deployments(metav1.NamespaceSystem).Get(CoreDNS, metav1.GetOptions{})
// check := func(imageTag string) {
// coreDNS, err := clientSet.AppsV1().Deployments(metav1.NamespaceSystem).Get(CoreDNS, metav1.GetOptions{})
Expect(err).ToNot(HaveOccurred())
Expect(coreDNS).ToNot(BeNil())
Expect(coreDNS.Spec.Template.Spec.Containers).To(HaveLen(1))
// Expect(err).ToNot(HaveOccurred())
// Expect(coreDNS).ToNot(BeNil())
// Expect(coreDNS.Spec.Template.Spec.Containers).To(HaveLen(1))
Expect(coreDNS.Spec.Template.Spec.Containers[0].Image).To(
Equal("602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/coredns:" + imageTag),
)
}
// Expect(coreDNS.Spec.Template.Spec.Containers[0].Image).To(
// Equal("602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/coredns:" + imageTag),
// )
// }
BeforeEach(func() {
clientSet, _ = testutils.NewFakeClientSetWithSamples("testdata/sample-1.11.json")
})
BeforeEach(func() {
clientSet, _ = testutils.NewFakeClientSetWithSamples("testdata/sample-1.11.json")
})
It("can load 1.11 sample", func() {
check("v1.1.3")
})
It("can load 1.11 sample", func() {
check("v1.1.3")
})
It("can update based to latest version", func() {
_, err := UpdateCoreDNSImageTag(clientSet, false)
Expect(err).ToNot(HaveOccurred())
check("v1.2.2")
})
It("can update based to latest version", func() {
_, err := UpdateCoreDNSImageTag(clientSet, false)
Expect(err).ToNot(HaveOccurred())
check("v1.2.2")
})
It("can dry-run update to latest version", func() {
_, err := UpdateCoreDNSImageTag(clientSet, true)
Expect(err).ToNot(HaveOccurred())
check("v1.1.3")
It("can dry-run update to latest version", func() {
_, err := UpdateCoreDNSImageTag(clientSet, true)
Expect(err).ToNot(HaveOccurred())
check("v1.1.3")
})
})
})
*/
})

0 comments on commit f114cde

Please sign in to comment.