mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-10-10 00:23:54 +00:00
Kata support several hypervisor and not all hypervisor support the same type of sockets, for example QEMU support vsock and unix sockets, while firecracker only support hybrid vsocks, hence sockets generations should be hypervisor specific fixes #2027 Signed-off-by: Julio Montes <julio.montes@intel.com>
32 lines
593 B
Go
32 lines
593 B
Go
// Copyright (c) 2019 Intel Corporation
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
package virtcontainers
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/kata-containers/runtime/virtcontainers/types"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestFCGenerateSocket(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
fc := firecracker{}
|
|
i, err := fc.generateSocket("a", false)
|
|
assert.Error(err)
|
|
assert.Nil(i)
|
|
|
|
i, err = fc.generateSocket("a", true)
|
|
assert.NoError(err)
|
|
assert.NotNil(i)
|
|
|
|
hvsock, ok := i.(types.HybridVSock)
|
|
assert.True(ok)
|
|
assert.NotEmpty(hvsock.UdsPath)
|
|
assert.NotZero(hvsock.Port)
|
|
}
|