MCPcopy Create free account
hub / github.com/danderson/netboot / TestMakeMsgReplyWithHttpClientArch

Function TestMakeMsgReplyWithHttpClientArch

dhcp6/packet_builder_test.go:269–294  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

267}
268
269func TestMakeMsgReplyWithHttpClientArch(t *testing.T) {
270 expectedClientID := []byte("clientid")
271 expectedServerID := []byte("serverid")
272 transactionID := [3]byte{'1', '2', '3'}
273 expectedIP := net.ParseIP("2001:db8:f00f:cafe::1")
274 expectedBootFileURL := []byte("http://bootfileurl")
275 identityAssociation := &IdentityAssociation{IPAddress: expectedIP, InterfaceID: []byte("id-1")}
276
277 builder := MakePacketBuilder(90, 100)
278
279 msg := builder.makeMsgReply(transactionID, expectedServerID, expectedClientID, 0x10,
280 []*IdentityAssociation{identityAssociation}, make([][]byte, 0), expectedBootFileURL, []net.IP{}, nil)
281
282 vendorClassOption := msg.Options[OptVendorClass]
283 if vendorClassOption == nil {
284 t.Fatalf("Vendor class option should be present")
285 }
286
287 bootfileURLOption := msg.Options.BootFileURL()
288 if bootfileURLOption == nil {
289 t.Fatalf("Bootfile URL option should be present")
290 }
291 if string(expectedBootFileURL) != string(bootfileURLOption) {
292 t.Fatalf("Expected bootfile URL %v, got %v", expectedBootFileURL, bootfileURLOption)
293 }
294}
295
296func TestMakeMsgReplyWithNoAddrsAvailable(t *testing.T) {
297 expectedClientID := []byte("clientid")

Callers

nothing calls this directly

Calls 3

MakePacketBuilderFunction · 0.85
makeMsgReplyMethod · 0.80
BootFileURLMethod · 0.80

Tested by

no test coverage detected