Merge pull request #79 from gyuho/fix

control: upload logs at the end of step2
This commit is contained in:
Gyu-Ho Lee 2016-11-15 16:17:46 -08:00 committed by GitHub
commit 99d6a5246f
1 changed files with 45 additions and 46 deletions

View File

@ -153,52 +153,6 @@ func generateReport(cfg Config, h []ReqHandler, reqGen func(chan<- request)) {
close(results)
<-pdoneC
{
u, err := remotestorage.NewGoogleCloudStorage([]byte(cfg.GoogleCloudStorageKey), cfg.GoogleCloudProjectName)
if err != nil {
plog.Fatal(err)
}
srcCSVResultPath := cfg.ResultPathTimeSeries
dstCSVResultPath := filepath.Base(cfg.ResultPathTimeSeries)
if !strings.HasPrefix(dstCSVResultPath, cfg.TestName) {
dstCSVResultPath = fmt.Sprintf("%s-%s", cfg.TestName, dstCSVResultPath)
}
dstCSVResultPath = filepath.Join(cfg.GoogleCloudStorageSubDirectory, dstCSVResultPath)
var uerr error
for k := 0; k < 15; k++ {
if uerr = u.UploadFile(cfg.GoogleCloudStorageBucketName, srcCSVResultPath, dstCSVResultPath); uerr != nil {
plog.Printf("#%d: UploadFile error %v", k, uerr)
time.Sleep(2 * time.Second)
continue
}
break
}
}
{
u, err := remotestorage.NewGoogleCloudStorage([]byte(cfg.GoogleCloudStorageKey), cfg.GoogleCloudProjectName)
if err != nil {
plog.Fatal(err)
}
srcCSVResultPath := cfg.ResultPathLog
dstCSVResultPath := filepath.Base(cfg.ResultPathLog)
if !strings.HasPrefix(dstCSVResultPath, cfg.TestName) {
dstCSVResultPath = fmt.Sprintf("%s-%s", cfg.TestName, dstCSVResultPath)
}
dstCSVResultPath = filepath.Join(cfg.GoogleCloudStorageSubDirectory, dstCSVResultPath)
var uerr error
for k := 0; k < 15; k++ {
if uerr = u.UploadFile(cfg.GoogleCloudStorageBucketName, srcCSVResultPath, dstCSVResultPath); uerr != nil {
plog.Printf("#%d: UploadFile error %v", k, uerr)
time.Sleep(2 * time.Second)
continue
}
break
}
}
}
func step2(cfg Config) error {
@ -352,6 +306,51 @@ func step2(cfg Config) error {
generateReport(cfg, h, reqGen)
}
{
u, err := remotestorage.NewGoogleCloudStorage([]byte(cfg.GoogleCloudStorageKey), cfg.GoogleCloudProjectName)
if err != nil {
plog.Fatal(err)
}
srcCSVResultPath := cfg.ResultPathTimeSeries
dstCSVResultPath := filepath.Base(cfg.ResultPathTimeSeries)
if !strings.HasPrefix(dstCSVResultPath, cfg.TestName) {
dstCSVResultPath = fmt.Sprintf("%s-%s", cfg.TestName, dstCSVResultPath)
}
dstCSVResultPath = filepath.Join(cfg.GoogleCloudStorageSubDirectory, dstCSVResultPath)
var uerr error
for k := 0; k < 15; k++ {
if uerr = u.UploadFile(cfg.GoogleCloudStorageBucketName, srcCSVResultPath, dstCSVResultPath); uerr != nil {
plog.Printf("#%d: UploadFile error %v", k, uerr)
time.Sleep(2 * time.Second)
continue
}
break
}
}
{
u, err := remotestorage.NewGoogleCloudStorage([]byte(cfg.GoogleCloudStorageKey), cfg.GoogleCloudProjectName)
if err != nil {
plog.Fatal(err)
}
srcCSVResultPath := cfg.ResultPathLog
dstCSVResultPath := filepath.Base(cfg.ResultPathLog)
if !strings.HasPrefix(dstCSVResultPath, cfg.TestName) {
dstCSVResultPath = fmt.Sprintf("%s-%s", cfg.TestName, dstCSVResultPath)
}
dstCSVResultPath = filepath.Join(cfg.GoogleCloudStorageSubDirectory, dstCSVResultPath)
var uerr error
for k := 0; k < 15; k++ {
if uerr = u.UploadFile(cfg.GoogleCloudStorageBucketName, srcCSVResultPath, dstCSVResultPath); uerr != nil {
plog.Printf("#%d: UploadFile error %v", k, uerr)
time.Sleep(2 * time.Second)
continue
}
break
}
}
return nil
}