Browse code

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 authored on 2023/01/10 23:16:51
Showing 5 changed files
... ...
@@ -63,7 +63,7 @@ func main() {
63 63
 	// NewSandbox accepts Variadic optional arguments which libnetwork can use.
64 64
 	sbx, err := controller.NewSandbox("container1",
65 65
 		libnetwork.OptionHostname("test"),
66
-		libnetwork.OptionDomainname("docker.io"))
66
+		libnetwork.OptionDomainname("example.com"))
67 67
 	if err != nil {
68 68
 		log.Fatalf("controller.NewSandbox: %s", err)
69 69
 	}
... ...
@@ -48,7 +48,7 @@ func main() {
48 48
 	// NewSandbox accepts Variadic optional arguments which libnetwork can use.
49 49
 	sbx, err := controller.NewSandbox("container1",
50 50
 		libnetwork.OptionHostname("test"),
51
-		libnetwork.OptionDomainname("docker.io"))
51
+		libnetwork.OptionDomainname("example.com"))
52 52
 	if err != nil {
53 53
 		log.Fatalf("controller.NewSandbox: %s", err)
54 54
 	}
... ...
@@ -33,7 +33,7 @@ create network namespaces and allocate interfaces for containers to use.
33 33
 	// NewSandbox accepts Variadic optional arguments which libnetwork can use.
34 34
 	sbx, err := controller.NewSandbox("container1",
35 35
 		libnetwork.OptionHostname("test"),
36
-		libnetwork.OptionDomainname("docker.io"))
36
+		libnetwork.OptionDomainname("example.com"))
37 37
 
38 38
 	// A sandbox can join the endpoint via the join api.
39 39
 	err = ep.Join(sbx)
... ...
@@ -45,7 +45,7 @@ func TestHost(t *testing.T) {
45 45
 
46 46
 	sbx1, err := controller.NewSandbox("host_c1",
47 47
 		libnetwork.OptionHostname("test1"),
48
-		libnetwork.OptionDomainname("docker.io"),
48
+		libnetwork.OptionDomainname("example.com"),
49 49
 		libnetwork.OptionExtraHost("web", "192.168.0.1"),
50 50
 		libnetwork.OptionUseDefaultSandbox())
51 51
 	if err != nil {
... ...
@@ -59,7 +59,7 @@ func TestHost(t *testing.T) {
59 59
 
60 60
 	sbx2, err := controller.NewSandbox("host_c2",
61 61
 		libnetwork.OptionHostname("test2"),
62
-		libnetwork.OptionDomainname("docker.io"),
62
+		libnetwork.OptionDomainname("example.com"),
63 63
 		libnetwork.OptionExtraHost("web", "192.168.0.1"),
64 64
 		libnetwork.OptionUseDefaultSandbox())
65 65
 	if err != nil {
... ...
@@ -109,7 +109,7 @@ func TestHost(t *testing.T) {
109 109
 	// Try to create another host endpoint and join/leave that.
110 110
 	cnt3, err := controller.NewSandbox("host_c3",
111 111
 		libnetwork.OptionHostname("test3"),
112
-		libnetwork.OptionDomainname("docker.io"),
112
+		libnetwork.OptionDomainname("example.com"),
113 113
 		libnetwork.OptionExtraHost("web", "192.168.0.1"),
114 114
 		libnetwork.OptionUseDefaultSandbox())
115 115
 	if err != nil {
... ...
@@ -292,7 +292,7 @@ func TestEndpointJoin(t *testing.T) {
292 292
 
293 293
 	sb, err := controller.NewSandbox(containerID,
294 294
 		libnetwork.OptionHostname("test"),
295
-		libnetwork.OptionDomainname("docker.io"),
295
+		libnetwork.OptionDomainname("example.com"),
296 296
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
297 297
 	if err != nil {
298 298
 		t.Fatal(err)
... ...
@@ -446,7 +446,7 @@ func externalKeyTest(t *testing.T, reexec bool) {
446 446
 
447 447
 	cnt, err := controller.NewSandbox(containerID,
448 448
 		libnetwork.OptionHostname("test"),
449
-		libnetwork.OptionDomainname("docker.io"),
449
+		libnetwork.OptionDomainname("example.com"),
450 450
 		libnetwork.OptionUseExternalKey(),
451 451
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
452 452
 	defer func() {
... ...
@@ -95,7 +95,7 @@ func TestNull(t *testing.T) {
95 95
 
96 96
 	cnt, err := controller.NewSandbox("null_container",
97 97
 		libnetwork.OptionHostname("test"),
98
-		libnetwork.OptionDomainname("docker.io"),
98
+		libnetwork.OptionDomainname("example.com"),
99 99
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
100 100
 	if err != nil {
101 101
 		t.Fatal(err)
... ...
@@ -937,7 +937,7 @@ func TestEndpointDeleteWithActiveContainer(t *testing.T) {
937 937
 
938 938
 	cnt, err := controller.NewSandbox(containerID,
939 939
 		libnetwork.OptionHostname("test"),
940
-		libnetwork.OptionDomainname("docker.io"),
940
+		libnetwork.OptionDomainname("example.com"),
941 941
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
942 942
 	defer func() {
943 943
 		if err := cnt.Delete(); err != nil {
... ...
@@ -996,7 +996,7 @@ func TestEndpointMultipleJoins(t *testing.T) {
996 996
 
997 997
 	sbx1, err := controller.NewSandbox(containerID,
998 998
 		libnetwork.OptionHostname("test"),
999
-		libnetwork.OptionDomainname("docker.io"),
999
+		libnetwork.OptionDomainname("example.com"),
1000 1000
 		libnetwork.OptionExtraHost("web", "192.168.0.1"),
1001 1001
 	)
1002 1002
 	if err != nil {
... ...
@@ -1133,7 +1133,7 @@ func TestContainerInvalidLeave(t *testing.T) {
1133 1133
 
1134 1134
 	cnt, err := controller.NewSandbox(containerID,
1135 1135
 		libnetwork.OptionHostname("test"),
1136
-		libnetwork.OptionDomainname("docker.io"),
1136
+		libnetwork.OptionDomainname("example.com"),
1137 1137
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
1138 1138
 	if err != nil {
1139 1139
 		t.Fatal(err)
... ...
@@ -1198,7 +1198,7 @@ func TestEndpointUpdateParent(t *testing.T) {
1198 1198
 
1199 1199
 	sbx1, err := controller.NewSandbox(containerID,
1200 1200
 		libnetwork.OptionHostname("test"),
1201
-		libnetwork.OptionDomainname("docker.io"),
1201
+		libnetwork.OptionDomainname("example.com"),
1202 1202
 		libnetwork.OptionExtraHost("web", "192.168.0.1"))
1203 1203
 	if err != nil {
1204 1204
 		t.Fatal(err)
... ...
@@ -1211,7 +1211,7 @@ func TestEndpointUpdateParent(t *testing.T) {
1211 1211
 
1212 1212
 	sbx2, err := controller.NewSandbox("c2",
1213 1213
 		libnetwork.OptionHostname("test2"),
1214
-		libnetwork.OptionDomainname("docker.io"),
1214
+		libnetwork.OptionDomainname("example.com"),
1215 1215
 		libnetwork.OptionHostsPath("/var/lib/docker/test_network/container2/hosts"),
1216 1216
 		libnetwork.OptionExtraHost("web", "192.168.0.2"))
1217 1217
 	if err != nil {