Skip to content

Commit

Permalink
Allow '.' character in inotify informer file names
Browse files Browse the repository at this point in the history
Signed-off-by: David Vossel <[email protected]>
  • Loading branch information
davidvossel committed Oct 2, 2017
1 parent cc5aa1b commit 863f6d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/inotify-informer/inotify.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func splitFileNamespaceName(fullPath string) (namespace string, domain string, e
}

namespace = namespaceName[0]
domain = strings.Split(namespaceName[1], ".")[0]
domain = namespaceName[1]
return namespace, domain, nil
}

Expand Down
10 changes: 5 additions & 5 deletions pkg/inotify-informer/inotify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ var _ = Describe("Inotify", func() {
Expect(err).ToNot(HaveOccurred())

// create two files
Expect(os.Create(tmpDir + "/" + "default_testvm.some-extension")).ToNot(BeNil())
Expect(os.Create(tmpDir + "/" + "default1_testvm1.some-extension")).ToNot(BeNil())
Expect(os.Create(tmpDir + "/" + "default_testvm")).ToNot(BeNil())
Expect(os.Create(tmpDir + "/" + "default1_testvm1")).ToNot(BeNil())

queue = workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter())
informer = cache.NewSharedIndexInformer(
Expand All @@ -79,8 +79,8 @@ var _ = Describe("Inotify", func() {

It("should detect multiple creations and deletions", func() {
num := 5
key := "default2/testvm2"
fileName := tmpDir + "/" + "default2_testvm2.some-extension"
key := "default2/test.vm2"
fileName := tmpDir + "/" + "default2_test.vm2"

for i := 0; i < num; i++ {
Expect(os.Create(fileName)).ToNot(BeNil())
Expand Down Expand Up @@ -111,7 +111,7 @@ var _ = Describe("Inotify", func() {

// Adding files in wrong formats should have an impact
// TODO should we just ignore them?
Expect(os.Create(tmpDir + "/" + "test.some-extension")).ToNot(BeNil())
Expect(os.Create(tmpDir + "/" + "test")).ToNot(BeNil())

// No event should be received
Consistently(i.ResultChan()).ShouldNot(Receive())
Expand Down

0 comments on commit 863f6d9

Please sign in to comment.