Revision 3446ec2b6020af2c8481fef379ebbdcbd04e9959 authored by Paul Chaignon on 21 April 2023, 11:46:42 UTC, committed by Nick Young on 26 July 2023, 01:02:34 UTC
[ upstream commit 67a3ab3533a7f77aa4241c0da6b04f5b31da9af9 ] [ Backporter's notes: the changes had to be manually backported to the appropriate files for v1.11, as they were renamed in ffd7e57b377f982fb57cf574564b7f1debef74a4 since then. (main > v1.11) test/k8s/datapath_configuration.go > test/k8sT/DatapathConfiguration.go ] If we check res.WasSuccessful() instead of res, then ginkgo won't print the error message in case the command wasn't successful. Signed-off-by: Paul Chaignon <paul@cilium.io> Signed-off-by: Nicolas Busseneau <nicolas@isovalent.com>
1 parent 0470ee5
ip_test.go
// SPDX-License-Identifier: Apache-2.0
// Copyright 2016-2017 Authors of Cilium
//go:build !privileged_tests
// +build !privileged_tests
package addressing
import (
"testing"
. "gopkg.in/check.v1"
)
// Hook up gocheck into the "go test" runner.
func Test(t *testing.T) {
TestingT(t)
}
type AddressingSuite struct{}
var _ = Suite(&AddressingSuite{})
func (s *AddressingSuite) TestCiliumIPv6(c *C) {
ip, err := NewCiliumIPv6("b007::")
c.Assert(err, IsNil)
ip2, _ := NewCiliumIPv6("")
c.Assert(ip2.IsSet(), Equals, false)
// Lacking a better Equals method, checking if the stringified IP is consistent
c.Assert(ip.String() == ip2.String(), Equals, false)
ip, err = NewCiliumIPv6("b007::aaaa:bbbb:0:0")
c.Assert(err, IsNil)
c.Assert(ip.String(), Equals, "b007::aaaa:bbbb:0:0")
c.Assert(ip.IsSet(), Equals, true)
}
func (s *AddressingSuite) TestCiliumIPv4(c *C) {
ip, err := NewCiliumIPv4("10.1.0.0")
c.Assert(err, IsNil)
c.Assert(ip.IsSet(), Equals, true)
ip2, _ := NewCiliumIPv4("")
c.Assert(ip2.IsSet(), Equals, false)
// Lacking a better Equals method, checking if the stringified IP is consistent
c.Assert(ip.String() == ip2.String(), Equals, false)
_, err = NewCiliumIPv4("b007::")
c.Assert(err, Not(Equals), nil)
}
func (s *AddressingSuite) TestCiliumIPv6Negative(c *C) {
ip, err := NewCiliumIPv6("")
c.Assert(err, NotNil)
c.Assert(ip, IsNil)
c.Assert(ip.String(), Equals, "")
ip, err = NewCiliumIPv6("192.168.0.1")
c.Assert(err, NotNil)
c.Assert(ip, IsNil)
}
func (s *AddressingSuite) TestCiliumIPv4Negative(c *C) {
ip, err := NewCiliumIPv4("")
c.Assert(err, NotNil)
c.Assert(ip, IsNil)
c.Assert(ip.String(), Equals, "")
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...