소스 검색

libnetwork: use example.com for tests and examples

Trying to remove the "docker.io" domain from locations where it's not relevant.
In these cases, this domain was used as a "random" domain for testing or example
purposes.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 2 년 전
부모
커밋
65aa43bf66
5개의 변경된 파일14개의 추가작업 그리고 14개의 파일을 삭제
  1. 1 1
      libnetwork/README.md
  2. 1 1
      libnetwork/cmd/readme_test/readme.go
  3. 1 1
      libnetwork/controller.go
  4. 5 5
      libnetwork/libnetwork_linux_test.go
  5. 6 6
      libnetwork/libnetwork_test.go

+ 1 - 1
libnetwork/README.md

@@ -63,7 +63,7 @@ func main() {
 	// NewSandbox accepts Variadic optional arguments which libnetwork can use.
 	// NewSandbox accepts Variadic optional arguments which libnetwork can use.
 	sbx, err := controller.NewSandbox("container1",
 	sbx, err := controller.NewSandbox("container1",
 		libnetwork.OptionHostname("test"),
 		libnetwork.OptionHostname("test"),
-		libnetwork.OptionDomainname("docker.io"))
+		libnetwork.OptionDomainname("example.com"))
 	if err != nil {
 	if err != nil {
 		log.Fatalf("controller.NewSandbox: %s", err)
 		log.Fatalf("controller.NewSandbox: %s", err)
 	}
 	}

+ 1 - 1
libnetwork/cmd/readme_test/readme.go

@@ -48,7 +48,7 @@ func main() {
 	// NewSandbox accepts Variadic optional arguments which libnetwork can use.
 	// NewSandbox accepts Variadic optional arguments which libnetwork can use.
 	sbx, err := controller.NewSandbox("container1",
 	sbx, err := controller.NewSandbox("container1",
 		libnetwork.OptionHostname("test"),
 		libnetwork.OptionHostname("test"),
-		libnetwork.OptionDomainname("docker.io"))
+		libnetwork.OptionDomainname("example.com"))
 	if err != nil {
 	if err != nil {
 		log.Fatalf("controller.NewSandbox: %s", err)
 		log.Fatalf("controller.NewSandbox: %s", err)
 	}
 	}

+ 1 - 1
libnetwork/controller.go

@@ -33,7 +33,7 @@ create network namespaces and allocate interfaces for containers to use.
 	// NewSandbox accepts Variadic optional arguments which libnetwork can use.
 	// NewSandbox accepts Variadic optional arguments which libnetwork can use.
 	sbx, err := controller.NewSandbox("container1",
 	sbx, err := controller.NewSandbox("container1",
 		libnetwork.OptionHostname("test"),
 		libnetwork.OptionHostname("test"),
-		libnetwork.OptionDomainname("docker.io"))
+		libnetwork.OptionDomainname("example.com"))
 
 
 	// A sandbox can join the endpoint via the join api.
 	// A sandbox can join the endpoint via the join api.
 	err = ep.Join(sbx)
 	err = ep.Join(sbx)

+ 5 - 5
libnetwork/libnetwork_linux_test.go

@@ -45,7 +45,7 @@ func TestHost(t *testing.T) {
 
 
 	sbx1, err := controller.NewSandbox("host_c1",
 	sbx1, err := controller.NewSandbox("host_c1",
 		libnetwork.OptionHostname("test1"),
 		libnetwork.OptionHostname("test1"),
-		libnetwork.OptionDomainname("docker.io"),
+		libnetwork.OptionDomainname("example.com"),
 		libnetwork.OptionExtraHost("web", "192.168.0.1"),
 		libnetwork.OptionExtraHost("web", "192.168.0.1"),
 		libnetwork.OptionUseDefaultSandbox())
 		libnetwork.OptionUseDefaultSandbox())
 	if err != nil {
 	if err != nil {
@@ -59,7 +59,7 @@ func TestHost(t *testing.T) {
 
 
 	sbx2, err := controller.NewSandbox("host_c2",
 	sbx2, err := controller.NewSandbox("host_c2",
 		libnetwork.OptionHostname("test2"),
 		libnetwork.OptionHostname("test2"),
-		libnetwork.OptionDomainname("docker.io"),
+		libnetwork.OptionDomainname("example.com"),
 		libnetwork.OptionExtraHost("web", "192.168.0.1"),
 		libnetwork.OptionExtraHost("web", "192.168.0.1"),
 		libnetwork.OptionUseDefaultSandbox())
 		libnetwork.OptionUseDefaultSandbox())
 	if err != nil {
 	if err != nil {
@@ -109,7 +109,7 @@ func TestHost(t *testing.T) {
 	// Try to create another host endpoint and join/leave that.
 	// Try to create another host endpoint and join/leave that.
 	cnt3, err := controller.NewSandbox("host_c3",
 	cnt3, err := controller.NewSandbox("host_c3",
 		libnetwork.OptionHostname("test3"),
 		libnetwork.OptionHostname("test3"),
-		libnetwork.OptionDomainname("docker.io"),
+		libnetwork.OptionDomainname("example.com"),
 		libnetwork.OptionExtraHost("web", "192.168.0.1"),
 		libnetwork.OptionExtraHost("web", "192.168.0.1"),
 		libnetwork.OptionUseDefaultSandbox())
 		libnetwork.OptionUseDefaultSandbox())
 	if err != nil {
 	if err != nil {
@@ -292,7 +292,7 @@ func TestEndpointJoin(t *testing.T) {
 
 
 	sb, err := controller.NewSandbox(containerID,
 	sb, err := controller.NewSandbox(containerID,
 		libnetwork.OptionHostname("test"),
 		libnetwork.OptionHostname("test"),
-		libnetwork.OptionDomainname("docker.io"),
+		libnetwork.OptionDomainname("example.com"),
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
 	if err != nil {
 	if err != nil {
 		t.Fatal(err)
 		t.Fatal(err)
@@ -446,7 +446,7 @@ func externalKeyTest(t *testing.T, reexec bool) {
 
 
 	cnt, err := controller.NewSandbox(containerID,
 	cnt, err := controller.NewSandbox(containerID,
 		libnetwork.OptionHostname("test"),
 		libnetwork.OptionHostname("test"),
-		libnetwork.OptionDomainname("docker.io"),
+		libnetwork.OptionDomainname("example.com"),
 		libnetwork.OptionUseExternalKey(),
 		libnetwork.OptionUseExternalKey(),
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
 	defer func() {
 	defer func() {

+ 6 - 6
libnetwork/libnetwork_test.go

@@ -95,7 +95,7 @@ func TestNull(t *testing.T) {
 
 
 	cnt, err := controller.NewSandbox("null_container",
 	cnt, err := controller.NewSandbox("null_container",
 		libnetwork.OptionHostname("test"),
 		libnetwork.OptionHostname("test"),
-		libnetwork.OptionDomainname("docker.io"),
+		libnetwork.OptionDomainname("example.com"),
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
 	if err != nil {
 	if err != nil {
 		t.Fatal(err)
 		t.Fatal(err)
@@ -937,7 +937,7 @@ func TestEndpointDeleteWithActiveContainer(t *testing.T) {
 
 
 	cnt, err := controller.NewSandbox(containerID,
 	cnt, err := controller.NewSandbox(containerID,
 		libnetwork.OptionHostname("test"),
 		libnetwork.OptionHostname("test"),
-		libnetwork.OptionDomainname("docker.io"),
+		libnetwork.OptionDomainname("example.com"),
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
 	defer func() {
 	defer func() {
 		if err := cnt.Delete(); err != nil {
 		if err := cnt.Delete(); err != nil {
@@ -996,7 +996,7 @@ func TestEndpointMultipleJoins(t *testing.T) {
 
 
 	sbx1, err := controller.NewSandbox(containerID,
 	sbx1, err := controller.NewSandbox(containerID,
 		libnetwork.OptionHostname("test"),
 		libnetwork.OptionHostname("test"),
-		libnetwork.OptionDomainname("docker.io"),
+		libnetwork.OptionDomainname("example.com"),
 		libnetwork.OptionExtraHost("web", "192.168.0.1"),
 		libnetwork.OptionExtraHost("web", "192.168.0.1"),
 	)
 	)
 	if err != nil {
 	if err != nil {
@@ -1133,7 +1133,7 @@ func TestContainerInvalidLeave(t *testing.T) {
 
 
 	cnt, err := controller.NewSandbox(containerID,
 	cnt, err := controller.NewSandbox(containerID,
 		libnetwork.OptionHostname("test"),
 		libnetwork.OptionHostname("test"),
-		libnetwork.OptionDomainname("docker.io"),
+		libnetwork.OptionDomainname("example.com"),
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
 	if err != nil {
 	if err != nil {
 		t.Fatal(err)
 		t.Fatal(err)
@@ -1198,7 +1198,7 @@ func TestEndpointUpdateParent(t *testing.T) {
 
 
 	sbx1, err := controller.NewSandbox(containerID,
 	sbx1, err := controller.NewSandbox(containerID,
 		libnetwork.OptionHostname("test"),
 		libnetwork.OptionHostname("test"),
-		libnetwork.OptionDomainname("docker.io"),
+		libnetwork.OptionDomainname("example.com"),
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
 	if err != nil {
 	if err != nil {
 		t.Fatal(err)
 		t.Fatal(err)
@@ -1211,7 +1211,7 @@ func TestEndpointUpdateParent(t *testing.T) {
 
 
 	sbx2, err := controller.NewSandbox("c2",
 	sbx2, err := controller.NewSandbox("c2",
 		libnetwork.OptionHostname("test2"),
 		libnetwork.OptionHostname("test2"),
-		libnetwork.OptionDomainname("docker.io"),
+		libnetwork.OptionDomainname("example.com"),
 		libnetwork.OptionHostsPath("/var/lib/docker/test_network/container2/hosts"),
 		libnetwork.OptionHostsPath("/var/lib/docker/test_network/container2/hosts"),
 		libnetwork.OptionExtraHost("web", "192.168.0.2"))
 		libnetwork.OptionExtraHost("web", "192.168.0.2"))
 	if err != nil {
 	if err != nil {