import (
"errors"
"fmt"
+ "io/ioutil"
"os"
"path/filepath"
Expect(netnsInode).NotTo(Equal(createdNetNSInode))
}
})
+
+ It("fails when the path is not a namespace", func() {
+ tempFile, err := ioutil.TempFile("", "nstest")
+ Expect(err).NotTo(HaveOccurred())
+ defer tempFile.Close()
+
+ nspath := tempFile.Name()
+ defer os.Remove(nspath)
+
+ _, err = ns.GetNS(nspath)
+ Expect(err).To(MatchError(fmt.Sprintf("%v is not of type NSFS", nspath)))
+ })
})
Describe("closing a network namespace", func() {