代码拉取完成,页面将自动刷新
package main
import (
"encoding/json"
"flag"
"fmt"
"github.com/pivotal-cloudops/cf-sli/http_wrapper"
"os"
uuid "github.com/nu7hatch/gouuid"
"github.com/pivotal-cloudops/cf-sli/cf_wrapper"
"github.com/pivotal-cloudops/cf-sli/config"
"github.com/pivotal-cloudops/cf-sli/logger"
"github.com/pivotal-cloudops/cf-sli/sli_executor"
)
type Output struct {
StartTime float64 `json:"app_start_time_in_sec"`
StopTime float64 `json:"app_stop_time_in_sec"`
StartStatus int `json:"app_start_status"`
StopStatus int `json:"app_stop_status"`
}
func main() {
var config config.Config
var cf_cli cf_wrapper.CfWrapper
http_wrapper := &http_wrapper.HttpWrapper{}
app_bits_path := flag.String("app-bits", "./assets/ruby_simple", "App bits path")
configLocation := flag.String("config", "./.config", "Config path")
flag.Parse()
err := config.LoadConfig(*configLocation)
if err != nil {
fmt.Fprint(os.Stderr, "Failed to load .config :\n")
fmt.Fprint(os.Stderr, err)
fmt.Fprint(os.Stderr, "\n")
os.Exit(1)
}
guid, err := uuid.NewV4()
if err != nil {
panic(err)
}
app_name := "cf-sli-app-" + guid.String()[0:18]
sli_executor := sli_executor.NewSliExecutor(cf_cli, http_wrapper, logger.NewLogger())
result, err := sli_executor.RunTest(app_name, *app_bits_path, config)
output := &Output{
StartTime: result.StartTime.Seconds(),
StopTime: result.StopTime.Seconds(),
StartStatus: result.StartStatus,
StopStatus: result.StopStatus,
}
json_output, err := json.Marshal(output)
if err != nil {
panic(err)
}
fmt.Fprintf(os.Stdout, string(json_output))
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。