Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove Namespace channel #212

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ spec:
channel.
type: boolean
pathname:
description: For a `namespace` channel, pathname is the name of the
namespace; For a `helmrepo` or `github` channel, pathname is the
description: For a `helmrepo` or `git` channel, pathname is the
remote URL for the channel contents; For a `objectbucket` channel,
pathname is the URL and name of the bucket.
type: string
Expand Down Expand Up @@ -198,12 +197,10 @@ spec:
type:
description: ChannelType defines types of channel
enum:
- Namespace
- HelmRepo
- ObjectBucket
- GitHub
- Git
- namespace
- helmrepo
- objectbucket
- github
Expand Down
83 changes: 0 additions & 83 deletions pkg/apis/apps/v1/channel_types_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/controller/channel/channel_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const (
timeout = time.Second * 5
targetNamespace = "default"
tragetChannelName = "foo"
targetChannelType = chv1.ChannelType("namespace")
targetChannelType = chv1.ChannelType("git")
)

var expectedRequest = reconcile.Request{NamespacedName: types.NamespacedName{Name: tragetChannelName, Namespace: targetNamespace}}
Expand Down
4 changes: 2 additions & 2 deletions pkg/utils/channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestGenerateChannelMap(t *testing.T) {
Namespace: chNs,
},
Spec: chv1.ChannelSpec{
Type: chv1.ChannelType("namespace"),
Type: chv1.ChannelType("git"),
},
}

Expand Down Expand Up @@ -83,7 +83,7 @@ func TestLocateChannel(t *testing.T) {
Namespace: chNs,
},
Spec: chv1.ChannelSpec{
Type: chv1.ChannelType("namespace"),
Type: chv1.ChannelType("git"),
},
}

Expand Down
92 changes: 0 additions & 92 deletions pkg/webhook/channel_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,64 +27,6 @@ import (
)

var _ = Describe("test channel validation logic", func() {
Context("given an exist namespace channel in a namespace", func() {
var (
chkey = types.NamespacedName{Name: "ch1", Namespace: "default"}
chnIns = chv1.Channel{
ObjectMeta: metav1.ObjectMeta{
Name: chkey.Name,
Namespace: chkey.Namespace},
Spec: chv1.ChannelSpec{
Type: chv1.ChannelType(chv1.ChannelTypeNamespace),
Pathname: chkey.Namespace,
},
}
)

BeforeEach(func() {
// Create the Channel object and expect the Reconcile
Expect(k8sClient.Create(context.TODO(), chnIns.DeepCopy())).NotTo(HaveOccurred())
})

AfterEach(func() {
Expect(k8sClient.Delete(context.TODO(), &chnIns)).Should(Succeed())
})

It("should create git channel", func() {
dupChn := chnIns.DeepCopy()
dupChn.Spec.Type = chv1.ChannelTypeGit
dupChn.SetName("dup-chn1")

Expect(k8sClient.Create(context.TODO(), dupChn)).Should(Succeed())
defer func() {
Expect(k8sClient.Delete(context.TODO(), dupChn)).Should(Succeed())
}()
})

It("should not create 2nd namespace channel", func() {
dupChn := chnIns.DeepCopy()
dupChn.SetName("dup-chn1")

Expect(k8sClient.Create(context.TODO(), dupChn)).ShouldNot(Succeed())
})

It("should not create 2nd objectbucket channel", func() {
dupChn := chnIns.DeepCopy()
dupChn.Spec.Type = chv1.ChannelTypeObjectBucket
dupChn.SetName("dup-chn1")

Expect(k8sClient.Create(context.TODO(), dupChn)).ShouldNot(Succeed())
})

It("should not create 2nd helm channel", func() {
dupChn := chnIns.DeepCopy()
dupChn.Spec.Type = chv1.ChannelTypeHelmRepo
dupChn.SetName("dup-chn1")

Expect(k8sClient.Create(context.TODO(), dupChn)).ShouldNot(Succeed())
})
})

Context("given exist git channels in a namespace", func() {
var (
chkey = types.NamespacedName{Name: "ch1", Namespace: "default"}
Expand Down Expand Up @@ -130,17 +72,6 @@ var _ = Describe("test channel validation logic", func() {
}()
})

It("should create 2nd namespace channel", func() {
dupChn := chnIns.DeepCopy()
dupChn.Spec.Type = chv1.ChannelTypeNamespace
dupChn.SetName("dup-chn1")

Expect(k8sClient.Create(context.TODO(), dupChn)).Should(Succeed())
defer func() {
Expect(k8sClient.Delete(context.TODO(), dupChn)).Should(Succeed())
}()
})

It("should create 2nd objectbucket channel", func() {
dupChn := chnIns.DeepCopy()
dupChn.Spec.Type = chv1.ChannelTypeObjectBucket
Expand Down Expand Up @@ -199,14 +130,6 @@ var _ = Describe("test channel validation logic", func() {
}()
})

It("shouldn't create 2nd namespace channel", func() {
dupChn := chnIns.DeepCopy()
dupChn.Spec.Type = chv1.ChannelTypeNamespace
dupChn.SetName("dup-chn1")

Expect(k8sClient.Create(context.TODO(), dupChn)).ShouldNot(Succeed())
})

It("shouldn't create 2nd objectbucket channel", func() {
dupChn := chnIns.DeepCopy()
dupChn.Spec.Type = chv1.ChannelTypeObjectBucket
Expand Down Expand Up @@ -258,14 +181,6 @@ var _ = Describe("test channel validation logic", func() {
}()
})

It("shouldn't create 2nd namespace channel", func() {
dupChn := chnIns.DeepCopy()
dupChn.Spec.Type = chv1.ChannelTypeNamespace
dupChn.SetName("dup-chn1")

Expect(k8sClient.Create(context.TODO(), dupChn)).ShouldNot(Succeed())
})

It("shouldn't create 2nd objectbucket channel", func() {
dupChn := chnIns.DeepCopy()
dupChn.Spec.Type = chv1.ChannelTypeObjectBucket
Expand All @@ -282,13 +197,6 @@ var _ = Describe("test channel validation logic", func() {
Expect(k8sClient.Create(context.TODO(), dupChn)).ShouldNot(Succeed())
})

It("shouldn't create 2nd namespace type channel(same name) when , with 409(AlreadyExists)", func() {
dupChn := chnIns.DeepCopy()
dupChn.Spec.Type = chv1.ChannelTypeNamespace
err := k8sClient.Create(context.TODO(), dupChn)
Expect(kerr.IsAlreadyExists(err)).Should(BeTrue())
})

It("shouldn't create 2nd objectbucket type channel(same name) when , with 409(AlreadyExists)", func() {
dupChn := chnIns.DeepCopy()
dupChn.Spec.Type = chv1.ChannelTypeObjectBucket
Expand Down