当前位置: 首页>>代码示例>>Golang>>正文


Golang DeployData.Log方法代码示例

本文整理汇总了Golang中github.com/tsuru/tsuru/app.DeployData.Log方法的典型用法代码示例。如果您正苦于以下问题:Golang DeployData.Log方法的具体用法?Golang DeployData.Log怎么用?Golang DeployData.Log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/tsuru/tsuru/app.DeployData的用法示例。


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

示例1: TestDeployInfoDiff

func (s *DeploySuite) TestDeployInfoDiff(c *check.C) {
	user, _ := s.token.User()
	a := app.App{Name: "g1", Platform: "python", TeamOwner: s.team.Name}
	err := app.CreateApp(&a, user)
	c.Assert(err, check.IsNil)
	recorder := httptest.NewRecorder()
	timestamp := time.Now()
	depData := []app.DeployData{
		{App: "g1", Timestamp: timestamp.Add(-3600 * time.Second), Commit: "e293e3e3me03ejm3puejmp3ej3iejop32", Error: "", Origin: "git"},
		{App: "g1", Timestamp: timestamp, Commit: "e82nn93nd93mm12o2ueh83dhbd3iu112", Error: "", Origin: "git", Diff: "fake-diff"},
	}
	lastDeploy := depData[1]
	evts := insertDeploysAsEvents(depData, c)
	url := fmt.Sprintf("/deploys/%s", evts[1].UniqueID.Hex())
	request, err := http.NewRequest("GET", url, nil)
	c.Assert(err, check.IsNil)
	request.Header.Set("Authorization", "bearer "+s.token.GetValue())
	server := RunServer(true)
	server.ServeHTTP(recorder, request)
	c.Assert(recorder.Code, check.Equals, http.StatusOK)
	c.Assert(recorder.Header().Get("Content-Type"), check.Equals, "application/json")
	lastDeploy.ID = evts[1].UniqueID
	var result app.DeployData
	err = json.Unmarshal(recorder.Body.Bytes(), &result)
	c.Assert(err, check.IsNil)
	result.Timestamp = lastDeploy.Timestamp
	result.RemoveDate = lastDeploy.RemoveDate
	result.Duration = 0
	result.Log = ""
	c.Assert(result, check.DeepEquals, lastDeploy)
}
开发者ID:tsuru,项目名称:tsuru,代码行数:31,代码来源:deploy_test.go


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