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

Golang v1.C类代码示例

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

本文整理汇总了Golang中gopkg/in/check/v1.C的典型用法代码示例。如果您正苦于以下问题:Golang C类的具体用法?Golang C怎么用?Golang C使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: TestRemove

func (s *initSystemSuite) TestRemove(c *gc.C) {
	s.addService("jujud-machine-0", "inactive")
	s.addListResponse()

	err := s.service.Remove()
	c.Assert(err, jc.ErrorIsNil)

	s.stub.CheckCalls(c, []testing.StubCall{{
		FuncName: "RunCommand",
		Args: []interface{}{
			listCmdArg,
		},
	}, {
		FuncName: "DisableUnitFiles",
		Args: []interface{}{
			[]string{s.name + ".service"},
			false,
		},
	}, {
		FuncName: "Reload",
	}, {
		FuncName: "RemoveAll",
		Args: []interface{}{
			fmt.Sprintf("%s/init/%s", s.dataDir, s.name),
		},
	}, {
		FuncName: "Close",
	}})
}
开发者ID:Pankov404,项目名称:juju,代码行数:29,代码来源:service_test.go


示例2: SetUpTest

func (s *ListSuite) SetUpTest(c *gc.C) {
	s.FakeJujuHomeSuite.SetUpTest(c)
	s.SetFeatureFlags(feature.JES)
	s.store = configstore.NewMem()

	var envList = []struct {
		name       string
		serverUUID string
		envUUID    string
	}{
		{
			name:       "test1",
			serverUUID: "test1-uuid",
			envUUID:    "test1-uuid",
		}, {
			name:       "test2",
			serverUUID: "test1-uuid",
			envUUID:    "test2-uuid",
		}, {
			name:    "test3",
			envUUID: "test3-uuid",
		},
	}
	for _, env := range envList {
		info := s.store.CreateInfo(env.name)
		info.SetAPIEndpoint(configstore.APIEndpoint{
			Addresses:   []string{"localhost"},
			CACert:      testing.CACert,
			EnvironUUID: env.envUUID,
			ServerUUID:  env.serverUUID,
		})
		err := info.Write()
		c.Assert(err, jc.ErrorIsNil)
	}
}
开发者ID:claudiu-coblis,项目名称:juju,代码行数:35,代码来源:list_test.go


示例3: TestListVolumes

func (s *storageSuite) TestListVolumes(c *gc.C) {
	s.storageClient.ListBlobsFunc = func(
		container string,
		params azurestorage.ListBlobsParameters,
	) (azurestorage.BlobListResponse, error) {
		return azurestorage.BlobListResponse{
			Blobs: []azurestorage.Blob{{
				Name: "volume-1.vhd",
				Properties: azurestorage.BlobProperties{
					ContentLength: 1024 * 1024, // 1MiB
				},
			}, {
				Name: "volume-0.vhd",
				Properties: azurestorage.BlobProperties{
					ContentLength: 1024 * 1024 * 1024 * 1024, // 1TiB
				},
			}, {
				Name: "junk.vhd",
			}, {
				Name: "volume",
			}},
		}, nil
	}

	volumeSource := s.volumeSource(c)
	volumeIds, err := volumeSource.ListVolumes()
	c.Assert(err, jc.ErrorIsNil)
	s.storageClient.CheckCallNames(c, "NewClient", "ListBlobs")
	s.storageClient.CheckCall(
		c, 0, "NewClient", fakeStorageAccount, fakeStorageAccountKey,
		"core.windows.net", azurestorage.DefaultAPIVersion, true,
	)
	s.storageClient.CheckCall(c, 1, "ListBlobs", "datavhds", azurestorage.ListBlobsParameters{})
	c.Assert(volumeIds, jc.DeepEquals, []string{"volume-1", "volume-0"})
}
开发者ID:exekias,项目名称:juju,代码行数:35,代码来源:storage_test.go


示例4: TestGetRejectsWrongEnvUUIDPath

func (s *charmsSuite) TestGetRejectsWrongEnvUUIDPath(c *gc.C) {
	url := s.charmsURL(c, "url=local:quantal/dummy-1&file=revision")
	url.Path = "/environment/dead-beef-123456/charms"
	resp, err := s.authRequest(c, "GET", url.String(), "", nil)
	c.Assert(err, jc.ErrorIsNil)
	s.assertErrorResponse(c, resp, http.StatusNotFound, `unknown environment: "dead-beef-123456"`)
}
开发者ID:kakamessi99,项目名称:juju,代码行数:7,代码来源:charms_test.go


示例5: TestOutputReporter

func (s *SelfSuite) TestOutputReporter(c *gc.C) {
	manifold := dependency.SelfManifold(s.engine)
	var reporter dependency.Reporter
	err := manifold.Output(s.engine, &reporter)
	c.Check(err, jc.ErrorIsNil)
	c.Check(reporter, gc.Equals, s.engine)
}
开发者ID:imoapps,项目名称:juju,代码行数:7,代码来源:self_test.go


示例6: TestDecodeCheckInvalidSignature

func (s *decodeSuite) TestDecodeCheckInvalidSignature(c *gc.C) {
	r := bytes.NewReader([]byte(invalidClearsignInput + signSuffix))
	_, err := simplestreams.DecodeCheckSignature(r, testSigningKey)
	c.Assert(err, gc.Not(gc.IsNil))
	_, ok := err.(*simplestreams.NotPGPSignedError)
	c.Assert(ok, jc.IsFalse)
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:7,代码来源:decode_test.go


示例7: TestAliasColumnSetTableName

func (s *ColumnSuite) TestAliasColumnSetTableName(c *gc.C) {
	col := Alias("foo", SqlFunc("max", table1Col1))

	// should always error
	err := col.setTableName("test")
	c.Assert(err, gc.NotNil)
}
开发者ID:Charlesdong,项目名称:godropbox,代码行数:7,代码来源:column_test.go


示例8: TestWorkerPathsWindows

func (s *PathsSuite) TestWorkerPathsWindows(c *gc.C) {
	s.PatchValue(&os.HostOS, func() os.OSType { return os.Windows })

	dataDir := c.MkDir()
	unitTag := names.NewUnitTag("some-service/323")
	worker := "some-worker"
	paths := uniter.NewWorkerPaths(dataDir, unitTag, worker)

	relData := relPathFunc(dataDir)
	relAgent := relPathFunc(relData("agents", "unit-some-service-323"))
	c.Assert(paths, jc.DeepEquals, uniter.Paths{
		ToolsDir: relData("tools/unit-some-service-323"),
		Runtime: uniter.RuntimePaths{
			JujuRunSocket:     `\\.\pipe\unit-some-service-323-some-worker-run`,
			JujucServerSocket: `\\.\pipe\unit-some-service-323-some-worker-agent`,
		},
		State: uniter.StatePaths{
			BaseDir:         relAgent(),
			CharmDir:        relAgent("charm"),
			OperationsFile:  relAgent("state", "uniter"),
			RelationsDir:    relAgent("state", "relations"),
			BundlesDir:      relAgent("state", "bundles"),
			DeployerDir:     relAgent("state", "deployer"),
			StorageDir:      relAgent("state", "storage"),
			MetricsSpoolDir: relAgent("state", "spool", "metrics"),
		},
	})
}
开发者ID:imoapps,项目名称:juju,代码行数:28,代码来源:paths_test.go


示例9: TestOther

func (s *PathsSuite) TestOther(c *gc.C) {
	s.PatchValue(&os.HostOS, func() os.OSType { return os.Unknown })

	dataDir := c.MkDir()
	unitTag := names.NewUnitTag("some-service/323")
	paths := uniter.NewPaths(dataDir, unitTag)

	relData := relPathFunc(dataDir)
	relAgent := relPathFunc(relData("agents", "unit-some-service-323"))
	c.Assert(paths, jc.DeepEquals, uniter.Paths{
		ToolsDir: relData("tools/unit-some-service-323"),
		Runtime: uniter.RuntimePaths{
			JujuRunSocket:     relAgent("run.socket"),
			JujucServerSocket: "@" + relAgent("agent.socket"),
		},
		State: uniter.StatePaths{
			BaseDir:         relAgent(),
			CharmDir:        relAgent("charm"),
			OperationsFile:  relAgent("state", "uniter"),
			RelationsDir:    relAgent("state", "relations"),
			BundlesDir:      relAgent("state", "bundles"),
			DeployerDir:     relAgent("state", "deployer"),
			StorageDir:      relAgent("state", "storage"),
			MetricsSpoolDir: relAgent("state", "spool", "metrics"),
		},
	})
}
开发者ID:imoapps,项目名称:juju,代码行数:27,代码来源:paths_test.go


示例10: TestSelectGetAllCompoundIndex

func (s *RethinkSuite) TestSelectGetAllCompoundIndex(c *test.C) {
	// Ensure table + database exist
	DBCreate("test").Exec(session)
	DB("test").TableDrop("TableCompound").Exec(session)
	DB("test").TableCreate("TableCompound").Exec(session)
	write, err := DB("test").Table("TableCompound").IndexCreateFunc("full_name", func(row Term) interface{} {
		return []interface{}{row.Field("first_name"), row.Field("last_name")}
	}).RunWrite(session)
	DB("test").Table("TableCompound").IndexWait().Exec(session)
	c.Assert(err, test.IsNil)
	c.Assert(write.Created, test.Equals, 1)

	// Insert rows
	DB("test").Table("TableCompound").Insert(nameList).Exec(session)

	// Test query
	var response interface{}
	query := DB("test").Table("TableCompound").GetAllByIndex("full_name", []interface{}{"John", "Smith"})
	res, err := query.Run(session)
	c.Assert(err, test.IsNil)

	err = res.One(&response)

	c.Assert(err, test.IsNil)
	c.Assert(response, jsonEquals, map[string]interface{}{"id": 1, "first_name": "John", "last_name": "Smith", "gender": "M"})

	res.Close()
}
开发者ID:XuesongYang,项目名称:shipyard,代码行数:28,代码来源:query_select_test.go


示例11: SetUpTest

func (s *credentialsSuite) SetUpTest(c *gc.C) {
	s.IsolationSuite.SetUpTest(c)

	var err error
	s.provider, err = environs.Provider("gce")
	c.Assert(err, jc.ErrorIsNil)
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:7,代码来源:credentials_test.go


示例12: TestReportError

func (s *ReportSuite) TestReportError(c *gc.C) {
	s.fix.run(c, func(engine *dependency.Engine) {
		mh1 := newManifoldHarness("missing")
		manifold := mh1.Manifold()
		err := engine.Install("task", manifold)
		c.Assert(err, jc.ErrorIsNil)
		mh1.AssertNoStart(c)

		workertest.CleanKill(c, engine)
		report := engine.Report()
		c.Check(report, jc.DeepEquals, map[string]interface{}{
			"state": "stopped",
			"error": nil,
			"manifolds": map[string]interface{}{
				"task": map[string]interface{}{
					"state":  "stopped",
					"error":  dependency.ErrMissing,
					"inputs": []string{"missing"},
					"resource-log": []map[string]interface{}{{
						"name":  "missing",
						"type":  "<nil>",
						"error": dependency.ErrMissing,
					}},
					"report": (map[string]interface{})(nil),
				},
			},
		})
	})
}
开发者ID:makyo,项目名称:juju,代码行数:29,代码来源:reporter_test.go


示例13: TestInstallCommandsLogfile

func (s *initSystemSuite) TestInstallCommandsLogfile(c *gc.C) {
	name := "jujud-machine-0"
	s.conf.Logfile = "/var/log/juju/machine-0.log"
	service := s.newService(c)
	commands, err := service.InstallCommands()
	c.Assert(err, jc.ErrorIsNil)

	test := systemdtesting.WriteConfTest{
		Service: name,
		DataDir: s.dataDir,
		Expected: strings.Replace(
			s.newConfStr(name),
			"ExecStart=/var/lib/juju/bin/jujud machine-0",
			"ExecStart=/var/lib/juju/init/jujud-machine-0/exec-start.sh",
			-1),
		Script: `
# Set up logging.
touch '/var/log/juju/machine-0.log'
chown syslog:syslog '/var/log/juju/machine-0.log'
chmod 0600 '/var/log/juju/machine-0.log'
exec >> '/var/log/juju/machine-0.log'
exec 2>&1

# Run the script.
`[1:] + jujud + " machine-0",
	}
	test.CheckCommands(c, commands)
}
开发者ID:Pankov404,项目名称:juju,代码行数:28,代码来源:service_test.go


示例14: SetUpTest

func (s *initSystemSuite) SetUpTest(c *gc.C) {
	s.BaseSuite.SetUpTest(c)

	dataDir, err := paths.DataDir("vivid")
	c.Assert(err, jc.ErrorIsNil)
	s.dataDir = dataDir
	// Patch things out.
	s.ch = systemd.PatchNewChan(s)

	s.stub = &testing.Stub{}
	s.conn = systemd.PatchNewConn(s, s.stub)
	s.fops = systemd.PatchFileOps(s, s.stub)
	s.exec = systemd.PatchExec(s, s.stub)

	// Set up the service.
	tagStr := "machine-0"
	tag, err := names.ParseTag(tagStr)
	c.Assert(err, jc.ErrorIsNil)
	s.tag = tag
	s.name = "jujud-" + tagStr
	s.conf = common.Conf{
		Desc:      "juju agent for " + tagStr,
		ExecStart: jujud + " " + tagStr,
	}
	s.service = s.newService(c)

	// Reset any incidental calls.
	s.stub.ResetCalls()
}
开发者ID:Pankov404,项目名称:juju,代码行数:29,代码来源:service_test.go


示例15: SetUpTest

func (s *DirectorySuite) SetUpTest(c *gc.C) {
	s.BaseSuite.SetUpTest(c)
	s.containerDir = c.MkDir()
	s.PatchValue(&container.ContainerDir, s.containerDir)
	s.removedDir = c.MkDir()
	s.PatchValue(&container.RemovedContainerDir, s.removedDir)
}
开发者ID:howbazaar,项目名称:juju,代码行数:7,代码来源:directory_test.go


示例16: TestLife

func (*lifeSuite) TestLife(c *gc.C) {
	st := &fakeState{
		entities: map[names.Tag]entityWithError{
			u("x/0"): &fakeLifer{life: state.Alive},
			u("x/1"): &fakeLifer{life: state.Dying},
			u("x/2"): &fakeLifer{life: state.Dead},
			u("x/3"): &fakeLifer{fetchError: "x3 error"},
		},
	}
	getCanRead := func() (common.AuthFunc, error) {
		x0 := u("x/0")
		x2 := u("x/2")
		x3 := u("x/3")
		return func(tag names.Tag) bool {
			return tag == x0 || tag == x2 || tag == x3
		}, nil
	}
	lg := common.NewLifeGetter(st, getCanRead)
	entities := params.Entities{[]params.Entity{
		{"unit-x-0"}, {"unit-x-1"}, {"unit-x-2"}, {"unit-x-3"}, {"unit-x-4"},
	}}
	results, err := lg.Life(entities)
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(results, gc.DeepEquals, params.LifeResults{
		Results: []params.LifeResult{
			{Life: params.Alive},
			{Error: apiservertesting.ErrUnauthorized},
			{Life: params.Dead},
			{Error: &params.Error{Message: "x3 error"}},
			{Error: apiservertesting.ErrUnauthorized},
		},
	})
}
开发者ID:imoapps,项目名称:juju,代码行数:33,代码来源:life_test.go


示例17: TestEnqueueActionRequiresName

func (s *ActionSuite) TestEnqueueActionRequiresName(c *gc.C) {
	name := ""

	// verify can not enqueue an Action without a name
	_, err := s.State.EnqueueAction(s.unit.Tag(), name, nil)
	c.Assert(err, gc.ErrorMatches, "action name required")
}
开发者ID:makyo,项目名称:juju,代码行数:7,代码来源:action_test.go


示例18: TestConnectionWaitOperationTimeout

func (s *rawConnSuite) TestConnectionWaitOperationTimeout(c *gc.C) {
	s.op.Status = StatusRunning
	err := s.rawConn.waitOperation("proj", s.op, s.strategy)

	c.Check(err, gc.ErrorMatches, ".* timed out .*")
	c.Check(s.callCount, gc.Equals, 4)
}
开发者ID:imoapps,项目名称:juju,代码行数:7,代码来源:raw_test.go


示例19: TestAliasColumnSerializeSqlForColumnListNilExpr

func (s *ColumnSuite) TestAliasColumnSerializeSqlForColumnListNilExpr(c *gc.C) {
	col := Alias("foo", nil)

	buf := &bytes.Buffer{}
	err := col.SerializeSqlForColumnList(buf)
	c.Assert(err, gc.NotNil)
}
开发者ID:Charlesdong,项目名称:godropbox,代码行数:7,代码来源:column_test.go


示例20: TestConnectionWaitOperation

func (s *rawConnSuite) TestConnectionWaitOperation(c *gc.C) {
	original := &compute.Operation{}
	err := s.rawConn.waitOperation("proj", original, s.strategy)

	c.Check(err, jc.ErrorIsNil)
	c.Check(s.callCount, gc.Equals, 1)
}
开发者ID:imoapps,项目名称:juju,代码行数:7,代码来源:raw_test.go



注:本文中的gopkg/in/check/v1.C类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang v1.Table函数代码示例发布时间:2022-05-28
下一篇:
Golang v1.TestingT函数代码示例发布时间: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