Skip to content

Commit

Permalink
updated proto, vendor dependencies #632
Browse files Browse the repository at this point in the history
allow screenshots to be taken via test code, #632

tests for screenshot mapping, #632

fixed vendoring, travis and appveyor build scripts

remove godep, use go 1.10

use proto.Equal to check proto message equality

reduce build log, use --verbose to print details

run appveyor tests in parallel
  • Loading branch information
sriv committed Jul 10, 2018
1 parent 72109fa commit 821138d
Show file tree
Hide file tree
Showing 337 changed files with 100,006 additions and 10,599 deletions.
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ os:
- osx
language: go
go:
- 1.9
- "1.10"
addons:
apt:
packages:
Expand All @@ -12,9 +12,6 @@ env:
- GAUGE_PREFIX="/tmp/gauge" GAUGE_TELEMETRY_ENABLED=false
before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export JAVA_HOME="/usr/lib/jvm/java-8-oracle"; fi
install:
- go get github.com/tools/godep
- godep restore
script:
- go run build/make.go
- go run build/make.go --test
Expand Down
183 changes: 0 additions & 183 deletions Godeps/Godeps.json

This file was deleted.

5 changes: 0 additions & 5 deletions Godeps/Readme

This file was deleted.

18 changes: 6 additions & 12 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,27 @@ init:
}
environment:
GOPATH: c:\gopath
GAUGE_PREFIX: c:\gauge
GAUGE_TELEMETRY_ENABLED: false
build_script:
- ps: >-
$env:Path = "$env:GOPATH\bin;" + [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
$env:Path = $env:GAUGE_PREFIX + "\bin;" + [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
go run build\make.go
go get github.com/tools/godep
go run build\make.go --test
go run build\make.go --install --prefix=$env:GAUGE_PREFIX
godep restore
go test ./...
go get github.com/getgauge/gauge
test_script:
- ps: >-
git clone --depth=1 https://github.com/getgauge/gauge-tests ../gauge-tests
cd ../gauge-tests
gauge install
mvn -q clean install -Denv=ci-java -DinParallel=false
mvn -q clean install -Denv=ci-java
$wc = New-Object 'System.Net.WebClient'
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\reports-java\xml-report\result.xml))
33 changes: 26 additions & 7 deletions build/make.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ func runProcess(command string, arg ...string) {
cmd := exec.Command(command, arg...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
log.Printf("Execute %v\n", cmd.Args)
if *verbose {
log.Printf("Execute %v\n", cmd.Args)
}
err := cmd.Run()
if err != nil {
panic(err)
Expand Down Expand Up @@ -97,7 +99,11 @@ func runTests(coverage bool) {
runProcess("go", "tool", "cover", "-html=count.out")
}
} else {
runProcess("go", "test", "./...", "-v")
if *verbose {
runProcess("go", "test", "./...", "-v")
} else {
runProcess("go", "test", "./...")
}
}
}

Expand All @@ -106,7 +112,9 @@ func installFiles(files map[string]string, installDir string) {
for src, dst := range files {
base := filepath.Base(src)
installDst := filepath.Join(installDir, dst)
log.Printf("Install %s -> %s\n", src, installDst)
if *verbose {
log.Printf("Install %s -> %s\n", src, installDst)
}
stat, err := os.Stat(src)
if err != nil {
panic(err)
Expand Down Expand Up @@ -143,6 +151,7 @@ var allPlatforms = flag.Bool("all-platforms", false, "Compiles for all platforms
var targetLinux = flag.Bool("target-linux", false, "Compiles for linux only, both x86 and x86_64")
var binDir = flag.String("bin-dir", "", "Specifies OS_PLATFORM specific binaries to install when cross compiling")
var distro = flag.Bool("distro", false, "Create gauge distributable")
var verbose = flag.Bool("verbose", false, "Print verbose details")
var skipWindowsDistro = flag.Bool("skip-windows", false, "Skips creation of windows distributable on unix machines while cross platform compilation")

// Defines all the compile targets
Expand All @@ -165,7 +174,11 @@ func main() {
if *nightly {
buildMetadata = fmt.Sprintf("nightly-%s", time.Now().Format(nightlyDatelayout))
}
fmt.Println("Build: " + buildMetadata)
if *verbose {
if *verbose {
fmt.Println("Build: " + buildMetadata)
}
}
if *test {
runTests(*coverage)
} else if *install {
Expand Down Expand Up @@ -212,7 +225,9 @@ func filteredPlatforms() []map[string]string {
func crossCompileGauge() {
for _, platformEnv := range filteredPlatforms() {
setEnv(platformEnv)
log.Printf("Compiling for platform => OS:%s ARCH:%s \n", platformEnv[GOOS], platformEnv[GOARCH])
if *verbose {
log.Printf("Compiling for platform => OS:%s ARCH:%s \n", platformEnv[GOOS], platformEnv[GOARCH])
}
compileGauge()
}
}
Expand All @@ -229,7 +244,9 @@ func createGaugeDistributables(forAllPlatforms bool) {
if forAllPlatforms {
for _, platformEnv := range filteredPlatforms() {
setEnv(platformEnv)
log.Printf("Creating distro for platform => OS:%s ARCH:%s \n", platformEnv[GOOS], platformEnv[GOARCH])
if *verbose {
log.Printf("Creating distro for platform => OS:%s ARCH:%s \n", platformEnv[GOOS], platformEnv[GOARCH])
}
createDistro()
}
} else {
Expand Down Expand Up @@ -335,7 +352,9 @@ func createZipFromUtil(dir, zipDir, pkgName string) {
zipargs = []string{"-noprofile", "-executionpolicy", "bypass", "-file", windowsZipScript, filepath.Join(absdir, zipDir), filepath.Join(absdir, pkgName+".zip")}
}
output, err := runCommand(zipcmd, zipargs...)
fmt.Println(output)
if *verbose {
fmt.Println(output)
}
if err != nil {
panic(fmt.Sprintf("Failed to zip: %s", err))
}
Expand Down
6 changes: 3 additions & 3 deletions conn/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestGetResponseForGaugeMessageWithTimeout(t *testing.T) {
if err != nil {
t.Errorf("expected err to be nil. got %v", err)
}
if !reflect.DeepEqual(res, responseMessage) {
if !proto.Equal(res, responseMessage) {
t.Errorf("expected : %v\ngot : %v", responseMessage, res)
}
}
Expand Down Expand Up @@ -150,7 +150,7 @@ func TestGetResponseForGaugeMessageShoudGiveTheRightResponse(t *testing.T) {
go getResponseForGaugeMessage(message, conn, response{}, 3*time.Second)

response := <-r.result
if !reflect.DeepEqual(response, responseMessage) {
if !proto.Equal(response, responseMessage) {
t.Errorf("expected : %v\ngot : %v", responseMessage, response)
}
}
Expand Down Expand Up @@ -237,7 +237,7 @@ func TestGetResponseForGaugeMessageShoudNotErrorIfNoTimeoutIsSpecified(t *testin
if err != nil {
t.Errorf("expected err to be nil. got %v", err)
}
if !reflect.DeepEqual(res, responseMessage) {
if !proto.Equal(res, responseMessage) {
t.Errorf("expected : %v\ngot : %v", responseMessage, res)
}
}
8 changes: 4 additions & 4 deletions execution/stepExecutor.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ func (e *stepExecutor) executeStep(step *gauge.Step, protoStep *gauge_messages.P
if !stepResult.GetFailed() {
executeStepMessage := &gauge_messages.Message{MessageType: gauge_messages.Message_ExecuteStep, ExecuteStepRequest: stepRequest}
stepExecutionStatus := e.runner.ExecuteAndGetStatus(executeStepMessage)
messages := append(stepResult.ProtoStepExecResult().GetExecutionResult().Message, stepExecutionStatus.Message...)
stepExecutionStatus.Message = messages
stepExecutionStatus.Message = append(stepResult.ProtoStepExecResult().GetExecutionResult().Message, stepExecutionStatus.Message...)
stepExecutionStatus.ScreenShot = append(stepResult.ProtoStepExecResult().GetExecutionResult().ScreenShot, stepExecutionStatus.ScreenShot...)
if stepExecutionStatus.GetFailed() {
e.currentExecutionInfo.CurrentStep.ErrorMessage = stepExecutionStatus.GetErrorMessage()
e.currentExecutionInfo.CurrentStep.StackTrace = stepExecutionStatus.GetStackTrace()
Expand Down Expand Up @@ -89,8 +89,8 @@ func (e *stepExecutor) notifyAfterStepHook(stepResult *result.StepResult) {
}

res := executeHook(m, stepResult, e.runner)
messages := append(stepResult.ProtoStepExecResult().GetExecutionResult().Message, res.Message...)
stepResult.ProtoStep.PostHookMessages = messages
stepResult.ProtoStep.PostHookMessages = append(stepResult.ProtoStepExecResult().GetExecutionResult().Message, res.Message...)
stepResult.ProtoStepExecResult().GetExecutionResult().ScreenShot = append(stepResult.ProtoStepExecResult().GetExecutionResult().ScreenShot, res.ScreenShot...)
if res.GetFailed() {
setStepFailure(e.currentExecutionInfo)
handleHookFailure(stepResult, res, result.AddPostHook)
Expand Down
Loading

0 comments on commit 821138d

Please sign in to comment.