コード例 #1
0
func uploadExtraData(p *model.RunParameters, result *devicefarm.ScheduleRunInput, wg *sync.WaitGroup) {
	if p.Config.AdditionalData.ExtraDataPackageArn == "" && p.Config.AdditionalData.ExtraDataPackagePath != "" {
		wg.Add(1)
		go func() {
			log.Println("Prepare extra data for uploading...")
			arn, url := CreateUploadWithType(p.Client, p.ProjectArn, p.Config.AdditionalData.ExtraDataPackagePath, "EXTERNAL_DATA")
			httpResponse := tools.UploadFile(p.Config.AdditionalData.ExtraDataPackagePath, url)
			if httpResponse != 200 {
				log.Fatal("Can't upload test app")
			}
			WaitForAppProcessed(p.Client, arn)
			result.Configuration.ExtraDataPackageArn = aws.String(arn)
			wg.Done()
		}()
	}
}
コード例 #2
0
func uploadTestPackage(p *model.RunParameters, result *devicefarm.ScheduleRunInput, wg *sync.WaitGroup) {
	if p.Config.Test.TestPackageArn == "" && p.Config.Test.TestPackagePath != "" {
		wg.Add(1)
		go func() {
			log.Println("Prepare tests for uploading...")
			t := model.GetUploadTypeForTest(p.Config.Test.Type)
			arn, url := CreateUploadWithType(p.Client, p.ProjectArn, p.Config.Test.TestPackagePath, t)
			httpResponse := tools.UploadFile(p.Config.Test.TestPackagePath, url)
			if httpResponse != 200 {
				log.Fatal("Can't upload test app")
			}
			WaitForAppProcessed(p.Client, arn)
			result.Test.TestPackageArn = aws.String(arn)
			wg.Done()
		}()
	}
}
コード例 #3
0
func runJob(client *devicefarm.DeviceFarm, config *model.RunConfig) {
	p := &model.RunParameters{
		Client:  client,
		Config:  config,
		Project: *project,
	}
	p.ProjectArn = service.GetProjectArn(p.Client, p.Project)
	if p.ProjectArn == "" {
		log.Fatal("Application finished, because it can't retrieve project ARN")
	}
	p.DeviceArn = service.GetDevicePoolArn(p.Client, p.ProjectArn, *devicePool)
	appArn, url := service.CreateUpload(p.Client, p.ProjectArn, *appPath)
	code := tools.UploadFile(*appPath, url)
	if code != 200 {
		log.Fatal("Can't upload an app to Device Farm")
	}
	p.AppArn = appArn
	service.WaitForAppProcessed(p.Client, p.AppArn)
	runArn, status := service.RunWithConfig(p)
	statusCheck(status)
	if *wait {
		service.WaitForRunEnds(p.Client, runArn)
	}
}