
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.
19 lines
455 B
Go
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"))
|
|
})
|
|
})
|