mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-18 14:54:19 +01:00
runtime: move all code to src/runtime
To prepare for merging into kata-containers repository. Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
35
src/runtime/cli/spec_test.go
Normal file
35
src/runtime/cli/spec_test.go
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2018 Huawei Corporation.
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
func TestSpecCliAction(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
actionFunc, ok := specCLICommand.Action.(func(context *cli.Context) error)
|
||||
assert.True(ok)
|
||||
|
||||
flagSet := flag.NewFlagSet("flag", flag.ContinueOnError)
|
||||
ctx := createCLIContext(flagSet)
|
||||
defer os.Remove(specConfig)
|
||||
err := actionFunc(ctx)
|
||||
assert.NoError(err)
|
||||
|
||||
pattern := "gid=5"
|
||||
patternRootless := "uidMappings"
|
||||
err = grep(pattern, specConfig)
|
||||
assert.NoError(err)
|
||||
err = grep(patternRootless, specConfig)
|
||||
assert.Error(err)
|
||||
}
|
||||
Reference in New Issue
Block a user