github.com/kata-containers/runtime@v0.0.0-20210505125100-04f29832a923/virtcontainers/macvtap_endpoint_test.go (about)

     1  // Copyright (c) 2018 Intel Corporation
     2  //
     3  // SPDX-License-Identifier: Apache-2.0
     4  //
     5  
     6  package virtcontainers
     7  
     8  import (
     9  	"testing"
    10  
    11  	"github.com/stretchr/testify/assert"
    12  )
    13  
    14  func TestCreateMacvtapEndpoint(t *testing.T) {
    15  	netInfo := NetworkInfo{
    16  		Iface: NetlinkIface{
    17  			Type: "macvtap",
    18  		},
    19  	}
    20  	expected := &MacvtapEndpoint{
    21  		EndpointType:       MacvtapEndpointType,
    22  		EndpointProperties: netInfo,
    23  	}
    24  
    25  	result, err := createMacvtapNetworkEndpoint(netInfo)
    26  	assert.NoError(t, err)
    27  	assert.Exactly(t, result, expected)
    28  }