Skip to content

Commit ea871c8

Browse files
emaicusbmcutler
authored andcommitted
16_Docker_Network (#16)
* began work on 16_docker_network * added 16_docker_network * Updated config * Finished work on 16_docker_network_python * Router cleanup * better documented the config.json * Enabled udp. * addressed comments
1 parent abaf572 commit ea871c8

File tree

18 files changed

+1790
-0
lines changed

18 files changed

+1790
-0
lines changed
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
{
2+
// docker_enabled must be true in order for networking to work. If you forget it,
3+
// your assignment should fail to build.
4+
"docker_enabled" : true,
5+
"autograding" : {
6+
"work_to_details" : [ "**/*.csv", "**/*.txt" ]
7+
},
8+
// Each testcase creates a new, unique set of docker containers and networks.
9+
"testcases" : [
10+
11+
// *************** TEST CASES *****************
12+
{
13+
"title" : "Ping Pong",
14+
"containers" : [
15+
{
16+
// Setting container_name allows you to later refer to the container by this handle
17+
// (e.g. when specifying outgoing connections). By default containers are named
18+
// container0, container1, container2, etc.
19+
"container_name" : "server",
20+
"commands" : ["python3 server.py server"],
21+
//outgoing_connections list the containers that this container is allowed to network to.
22+
"outgoing_connections" : ["client"]
23+
// You can specify a docker image here, and if it is built on submitty, this container
24+
// will use it. At the moment, this field defaults to ubuntu:custom if unset -- the default
25+
// submitty image.
26+
//container_image : <image_name>
27+
},
28+
{
29+
"container_name" : "client",
30+
// It can be important to ensure your container's start in the correct order.
31+
// In this example, we want the server to start before the client, so we add a sleep command.
32+
"commands" : ["sleep 1", "python3 client.py client 0"],
33+
"outgoing_connections" : ["server"]
34+
},
35+
{
36+
// At the moment, a router should always be specified, which relays student messages.
37+
// The router should have the unique name "router."
38+
"container_name" : "router",
39+
"commands" : ["python3 router.py"]
40+
}
41+
],
42+
"points" : 5,
43+
"validation": [
44+
{
45+
"method" : "diff",
46+
//output files are stored in a directory that matches the container_name specified above.
47+
"actual_file" : "server/STDOUT.txt",
48+
"expected_file" : "expected_server_output_0.txt",
49+
"failure_message" : "ERROR: Your code did not match the expected output.",
50+
"show_message" : "on_failure",
51+
"deduction" : 0.5
52+
},
53+
{
54+
"method" : "diff",
55+
"actual_file" : "client/STDOUT_1.txt",
56+
"expected_file" : "expected_client_output_0.txt",
57+
"failure_message" : "ERROR: Your code did not match the expected output.",
58+
"show_message" : "on_failure",
59+
"deduction" : 0.5
60+
}
61+
]
62+
},
63+
{
64+
"title" : "Ping Pong, Ping Pong",
65+
"containers" : [
66+
{
67+
"container_name" : "server",
68+
"commands" : ["python3 server.py server"], //string or array of strings.
69+
"outgoing_connections" : ["client"]
70+
},
71+
{
72+
"container_name" : "client",
73+
"commands" : ["sleep 1", "python3 client.py client 1"],
74+
"outgoing_connections" : ["server"]
75+
},
76+
{
77+
"container_name" : "router",
78+
"commands" : ["python3 router.py"]
79+
}
80+
],
81+
"points" : 5,
82+
"validation": [
83+
{
84+
"method" : "diff",
85+
"actual_file" : "server/STDOUT.txt",
86+
"expected_file" : "expected_server_output_1.txt",
87+
"failure_message" : "ERROR: Your code did not match the expected output.",
88+
"show_message" : "on_failure",
89+
"deduction" : 0.5
90+
},
91+
{
92+
"method" : "diff",
93+
"actual_file" : "client/STDOUT_1.txt",
94+
"expected_file" : "expected_client_output_1.txt",
95+
"failure_message" : "ERROR: Your code did not match the expected output.",
96+
"show_message" : "on_failure",
97+
"deduction" : 0.5
98+
}
99+
]
100+
},
101+
{
102+
"title" : "Not Ping",
103+
"containers" : [
104+
{
105+
"container_name" : "server",
106+
"commands" : ["python3 server.py server"], //string or array of strings.
107+
"outgoing_connections" : ["client"]
108+
},
109+
{
110+
"container_name" : "client",
111+
"commands" : ["sleep 1", "python3 client.py client 2"],
112+
"outgoing_connections" : ["server"]
113+
},
114+
{
115+
"container_name" : "router",
116+
"commands" : ["python3 router.py"]
117+
}
118+
],
119+
"points" : 5,
120+
"validation": [
121+
{
122+
"method" : "diff",
123+
"actual_file" : "server/STDOUT.txt",
124+
"expected_file" : "expected_server_output_2.txt",
125+
"failure_message" : "ERROR: Your code did not match the expected output.",
126+
"show_message" : "on_failure",
127+
"deduction" : 0.5
128+
},
129+
{
130+
"method" : "diff",
131+
"actual_file" : "client/STDOUT_1.txt",
132+
"expected_file" : "expected_client_output_2.txt",
133+
"failure_message" : "ERROR: Your code did not match the expected output.",
134+
"show_message" : "on_failure",
135+
"deduction" : 0.5
136+
}
137+
]
138+
},
139+
{
140+
"title" : "Not Ping, Ping, Ping",
141+
"containers" : [
142+
{
143+
"container_name" : "server",
144+
"commands" : ["python3 server.py server"], //string or array of strings.
145+
"outgoing_connections" : ["client"]
146+
},
147+
{
148+
"container_name" : "client",
149+
"commands" : ["sleep 1", "python3 client.py client 3"],
150+
"outgoing_connections" : ["server"]
151+
},
152+
{
153+
"container_name" : "router",
154+
"commands" : ["python3 router.py"]
155+
}
156+
],
157+
"points" : 5,
158+
"validation": [
159+
{
160+
"method" : "diff",
161+
"actual_file" : "server/STDOUT.txt",
162+
"expected_file" : "expected_server_output_3.txt",
163+
"failure_message" : "ERROR: Your code did not match the expected output.",
164+
"show_message" : "on_failure",
165+
"deduction" : 0.5
166+
},
167+
{
168+
"method" : "diff",
169+
"actual_file" : "client/STDOUT_1.txt",
170+
"expected_file" : "expected_client_output_3.txt",
171+
"failure_message" : "ERROR: Your code did not match the expected output.",
172+
"show_message" : "on_failure",
173+
"deduction" : 0.5
174+
}
175+
]
176+
},
177+
{
178+
"title" : "UDP Test",
179+
"extra_credit" : true,
180+
"containers" : [
181+
{
182+
"container_name" : "server",
183+
"commands" : ["python3 server.py server udp_enabled"], //string or array of strings.
184+
"outgoing_connections" : ["client"]
185+
},
186+
{
187+
"container_name" : "client",
188+
"commands" : ["sleep 1", "python3 client.py client 4 udp_enabled"],
189+
"outgoing_connections" : ["server"]
190+
},
191+
{
192+
"container_name" : "router",
193+
"commands" : ["python3 router.py"]
194+
}
195+
],
196+
"points" : 5,
197+
"validation": [
198+
{
199+
"method" : "diff",
200+
"actual_file" : "client/STDOUT_1.txt",
201+
"expected_file" : "expected_client_output_4.txt",
202+
"failure_message" : "ERROR: Your code did not match the expected output.",
203+
"show_message" : "on_failure",
204+
"deduction" : 1.0
205+
}
206+
]
207+
}
208+
]
209+
}

0 commit comments

Comments
 (0)