• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang manager.TestResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/huawei-openlab/oct/tools/specsValidator/manager.TestResult的典型用法代码示例。如果您正苦于以下问题:Golang TestResult类的具体用法?Golang TestResult怎么用?Golang TestResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TestResult类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: TestLinuxCapabilitiesSETFCAP

func TestLinuxCapabilitiesSETFCAP() string {
	// copy the testbin into container
	cmd := exec.Command("/bin/sh", "-c", "cp  cases/linuxcapabilities/capabilitytestbin /tmp/testtool")
	_, err := cmd.Output()
	if err != nil {
		log.Fatalf("[specsValidator] linux Capabilities test : init the testbin file error, %v", err)
	}

	linuxspec := setCapability("SETFCAP")
	linuxspec.Spec.Process.Args = []string{"/sbin/setcap", "CAP_SETFCAP=eip", "/testtool/capabilitytestbin"}
	capability := linuxspec.Linux.Capabilities
	configFile := "./config.json"
	err = configconvert.LinuxSpecToConfig(configFile, &linuxspec)
	out, err := adaptor.StartRunc(configFile)
	var result string
	var errout error
	if err != nil {
		result = manager.UNSPPORTED
		errout = errors.New(string(out) + err.Error())
	} else if strings.EqualFold(strings.TrimSpace(string(out)), "") {
		result = manager.PASSED
		errout = nil
	} else {
		result = manager.FAILED
		errout = nil
	}
	var testResult manager.TestResult
	testResult.Set("TestMountTmpfs", capability, errout, result)
	return testResult.Marshal()
}
开发者ID:Issacpeng,项目名称:oct,代码行数:30,代码来源:test_capabilities_SETFCAP.go


示例2: TestLinuxApparmorProfile

func TestLinuxApparmorProfile() string {
	apparmorfile := "testapporprofile"
	linuxspec := setApparmorProfile(apparmorfile)
	result, err := testApparmorProfile(&linuxspec)
	var testResult manager.TestResult
	testResult.Set("TestLinuxApparmorProfile", linuxspec.Linux.ApparmorProfile, err, result)
	return testResult.Marshal()
}
开发者ID:Issacpeng,项目名称:oct,代码行数:8,代码来源:test_linuxapparmorprofile.go


示例3: TestPathError

func TestPathError() string {
	linuxspec := setRoot(true, testPathError)
	root := linuxspec.Spec.Root
	result, err := testRoot(&linuxspec, true, testPathError)
	var testResult manager.TestResult
	testResult.Set("TestPathError", root, err, result)
	return testResult.Marshal()
}
开发者ID:Issacpeng,项目名称:oct,代码行数:8,代码来源:test_root_readonly.go


示例4: TestPlatformCorrect

func TestPlatformCorrect() string {
	linuxspec := setPlatform(runtime.GOOS, runtime.GOARCH)
	platform := linuxspec.Spec.Platform
	result, err := testPlatform(&linuxspec, runtime.GOOS, runtime.GOARCH)
	var testResult manager.TestResult
	testResult.Set("TestPlatformCorrect", platform, err, result)
	return testResult.Marshal()
}
开发者ID:Issacpeng,项目名称:oct,代码行数:8,代码来源:test_platform.go


示例5: TestMountTmpfs

func TestMountTmpfs() string {
	linuxspec := setMount("tmpfs", "tmpfs", "/mountTest", "")
	mount := linuxspec.Spec.Mounts
	result, err := testMount(&linuxspec)
	var testResult manager.TestResult
	testResult.Set("TestMountTmpfs", mount, err, result)
	return testResult.Marshal()
}
开发者ID:Issacpeng,项目名称:oct,代码行数:8,代码来源:test_mount_tmpfs.go


示例6: TestReadOnlyFalse

func TestReadOnlyFalse() string {
	linuxspec := setRoot(false, testPathCorrect)
	root := linuxspec.Spec.Root
	result, err := testRoot(&linuxspec, false, testPathCorrect)
	var testResult manager.TestResult
	testResult.Set("TestReadOnlyFalse", root, err, result)
	return testResult.Marshal()
}
开发者ID:Issacpeng,项目名称:oct,代码行数:8,代码来源:test_root_readonly.go


示例7: TestRootfsPropagationShare

func TestRootfsPropagationShare() string {
	mode := "share"
	linuxspec := setRootfsPropagation(mode)
	result, err := testRootfsPropagationHost(&linuxspec, "linuxrootfspropagation")
	var testResult manager.TestResult
	testResult.Set("TestRootfsPropagationShare", linuxspec.Linux.RootfsPropagation, err, result)
	return testResult.Marshal()
}
开发者ID:Issacpeng,项目名称:oct,代码行数:8,代码来源:test_linuxrootpropagation.go


示例8: TestVersionCorrect

func TestVersionCorrect() string {

	linuxspec := setVersion(testValueCorrect)
	version := linuxspec.Spec.Version
	result, err := testVersion(&linuxspec)
	var testResult manager.TestResult
	testResult.Set("TestVersionCorrect", version, err, result)
	return testResult.Marshal()
}
开发者ID:Issacpeng,项目名称:oct,代码行数:9,代码来源:test_version_correct.go


示例9: TestLinuxSelinuxProcessLabel

func TestLinuxSelinuxProcessLabel() string {
	labelin := "system_u:system_r:svirt_lxc_net_t:s0:c124,c675"
	linuxspec := setSElinuxLabel(labelin)
	go testSElinuxLabel(&linuxspec)
	result, err := checkProcessLableFromHost(labelin)
	var testResult manager.TestResult
	testResult.Set("TestLinuxSelinuxProcessLabel", linuxspec.Linux.SelinuxProcessLabel, err, result)
	return testResult.Marshal()
}
开发者ID:Issacpeng,项目名称:oct,代码行数:9,代码来源:test_linuxseliuxlabel.go


示例10: TestPlatformErr

func TestPlatformErr() string {
	osErr := "osErr"
	archErr := "archErr"
	linuxspec := setPlatform(osErr, archErr)
	platform := linuxspec.Spec.Platform
	result, err := testPlatform(&linuxspec, osErr, archErr)
	var testResult manager.TestResult
	testResult.Set("TestPlatformErr", platform, err, result)
	return testResult.Marshal()
}
开发者ID:Issacpeng,项目名称:oct,代码行数:10,代码来源:test_platform.go


示例11: TestRlimitNOFILEHard

func TestRlimitNOFILEHard() string {
	var rlimitstest specs.Rlimit = specs.Rlimit{
		Type: syscall.RLIMIT_NOFILE,
		Soft: uint64(1024),
		Hard: uint64(20480),
	}
	var testResult manager.TestResult
	linuxspec := setRlimits(rlimitstest)
	result, err := testRlimits(&linuxspec, "-n", strconv.FormatUint(rlimitstest.Hard, 10), false)
	testResult.Set("TestRlimitNOFILEHard", rlimitstest.Hard, err, result)
	return testResult.Marshal()
}
开发者ID:Issacpeng,项目名称:oct,代码行数:12,代码来源:test_linuxrlimits_RLIMIT_NPROC.go


示例12: TestUtsPathEmpty

func TestUtsPathEmpty() string {

	ns := specs.Namespace{Type: "uts",
		Path: ""}

	ls := setUtsSpec(ns)
	result, err := TestPathEmpty(&ls, "/proc/*/ns/uts")

	var testResult manager.TestResult
	testResult.Set("TestUtsPathEmpty", ns, err, result)
	return testResult.Marshal()
}
开发者ID:Issacpeng,项目名称:oct,代码行数:12,代码来源:uts.go


示例13: TestIpcPathUnempty

func TestIpcPathUnempty() string {

	ns := specs.Namespace{Type: "ipc",
		Path: "/proc/1/ns/ipc"}

	ls := setIpcSpec(ns)
	result, err := TestPathUnEmpty(&ls, ns.Path)

	var testResult manager.TestResult
	testResult.Set("TestIpcPathUnempty", ns, err, result)
	return testResult.Marshal()
}
开发者ID:Issacpeng,项目名称:oct,代码行数:12,代码来源:ipc.go


示例14: TestMntPathEmpty

func TestMntPathEmpty() string {

	ns := specs.Namespace{Type: "mount",
		Path: ""}

	ls := linuxSpec
	ls.Process.Args = append(ls.Process.Args, "/bin/readlink", "/proc/self/ns/mnt")
	result, err := TestPathEmpty(&ls, "/proc/*/ns/mnt")

	var testResult manager.TestResult
	testResult.Set("TestMntPathEmpty", ns, err, result)
	return testResult.Marshal()
}
开发者ID:Issacpeng,项目名称:oct,代码行数:13,代码来源:mount.go


示例15: TestBase

func TestBase() string {
	var process specs.Process = specs.Process{
		Terminal: false,
		User: specs.User{
			UID:            0,
			GID:            0,
			AdditionalGids: []int32{},
		},
		Args: []string{"./specprocess"},
		Env:  nil,
		Cwd:  "/containerend",
	}

	linuxspec := setProcess(process)
	newProcess := linuxspec.Spec.Process
	result, err := testProcess(&linuxspec, true)
	var testResult manager.TestResult
	testResult.Set("TestBase", newProcess, err, result)
	return testResult.Marshal()
}
开发者ID:Issacpeng,项目名称:oct,代码行数:20,代码来源:test_base.go


示例16: TestMemoryLimit

func TestMemoryLimit() string {
	var testResourceseMemory specs.Resources = specs.Resources{
		Memory: specs.Memory{
			Limit:       204800,
			Reservation: 0,
			Swap:        0,
			Kernel:      0,
			Swappiness:  -1,
		},
	}
	linuxspec := setResources(testResourceseMemory)
	go testResources(&linuxspec)
	time.Sleep(time.Second * 3)
	// defer cleanCgroup()
	defer adaptor.CleanRunc()
	result, err := checkConfigurationFromHost("memory.limit_in_bytes", "204800")
	var testResult manager.TestResult
	testResult.Set("TestMemoryLimit", testResourceseMemory.Memory, err, result)
	return testResult.Marshal()
}
开发者ID:Issacpeng,项目名称:oct,代码行数:20,代码来源:test_linuxresources_memory_limit.go



注:本文中的github.com/huawei-openlab/oct/tools/specsValidator/manager.TestResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang fargo.NewConnFromConfigFile函数代码示例发布时间:2022-05-28
下一篇:
Golang manager.TestResult类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap