Skip to content

Commit

Permalink
spin up arangodb in wercker
Browse files Browse the repository at this point in the history
  • Loading branch information
makii42 committed Apr 4, 2017
1 parent f7a1b9e commit 310418c
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ _testmain.go
*.test

.*
.wercker
16 changes: 16 additions & 0 deletions config_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package aranGO

import (
"fmt"
"log"
"os"
)

// Configure to start testing
var (
TestCollection = "TestCollection"
Expand All @@ -13,6 +19,16 @@ var (
s *Session
)

func init() {
if wercker := os.Getenv("WERCKER"); wercker == "true" {
log.Printf("Found WERCKER env!")
arangoPort := os.Getenv("ARANGODB_PORT_8529_TCP_PORT")
arangoIP := os.Getenv("ARANGODB_PORT_8529_TCP_ADDR")
TestServer = fmt.Sprintf("http://%s:%s", arangoIP, arangoPort)
}
log.Printf("using TestServer at %s", TestServer)
}

// document to test
type DocTest struct {
Document // arango Document to save id, key, rev
Expand Down
4 changes: 2 additions & 2 deletions simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package aranGO

import (
"testing"

"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -40,7 +41,7 @@ func TestSimple(t *testing.T) {

// Example
TestDoc = DocTest{} // Clean TestDoc variable
cur, err := c.Example(map[string]interface{}{"Text" : TestString}, 0, 10)
cur, err := c.Example(map[string]interface{}{"Text": TestString}, 0, 10)
assert.Equal(t, TestDoc.Error, false)
assert.Nil(t, err)
assert.NotNil(t, cur)
Expand All @@ -51,5 +52,4 @@ func TestSimple(t *testing.T) {
assert.Equal(t, TestString, TestDoc.Text)

// need to add new functions!

}
27 changes: 27 additions & 0 deletions wercker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
box: golang
services:
- id: arangodb
env:
ARANGO_NO_AUTH: 1
build:
steps:
- install-packages:
packages: netcat
- setup-go-workspace:
package-dir: github.com/diegogub/aranGO
- script:
name: go get
code: |
go get -t
- script:
name: go build
code: |
go build ./...
- script:
name: Wait for Arangodb connection if it is slow
code: |
while ! nc -nvz $ARANGODB_PORT_8529_TCP_ADDR $ARANGODB_PORT_8529_TCP_PORT ; do echo "."; sleep 2; done
- script:
name: go test
code: |
go test ./...

0 comments on commit 310418c

Please sign in to comment.