Abhishek Chanda b87cf1ba9c pkg: add a function to generate chain names
Adds a function to generate chain names for use in iptables and
ports all drivers to use that function. Also adds tests for the
said function.
2016-03-31 18:01:32 +02:00

19 lines
455 B
Go

package utils
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Utils", func() {
It("should format a short name", func() {
chain := FormatChainName("test", "1234")
Expect(chain).To(Equal("CNI-test-d404559f602eab6f"))
})
It("should truncate a long name", func() {
chain := FormatChainName("testalongnamethatdoesnotmakesense", "1234")
Expect(chain).To(Equal("CNI-testalongnamethat-d404559f602eab6f"))
})
})