Skip to content

Commit

Permalink
all test green (#40)
Browse files Browse the repository at this point in the history
* restore api code

* fixing tests

* update test to latest API changes

* fix readme
  • Loading branch information
foldingbeauty authored Nov 22, 2016
1 parent e03b770 commit d5a32e9
Show file tree
Hide file tree
Showing 262 changed files with 26,532 additions and 6,859 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ MAINTAINER Daniel van Gils
RUN go get github.com/mitchellh/gox

#gat all the go testing stuff
RUN go get github.com/tools/godep
RUN go get github.com/onsi/ginkgo/ginkgo
RUN go get github.com/onsi/gomega

Expand Down
1 change: 1 addition & 0 deletions Dockerfile.tester
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM golang:1.6
MAINTAINER Daniel van Gils

#get all the go testing stuff
RUN go get github.com/tools/godep
RUN go get github.com/onsi/ginkgo/ginkgo
RUN go get github.com/onsi/gomega

Expand Down
76 changes: 74 additions & 2 deletions Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"os"
)

var _ = Describe("Running Starter in damon mode", func() {
var _ = Describe("Running Starter in daemon mode", func() {

Context("ping the service", func() {
It("should respond with ok", func() {
Expand All @@ -29,7 +29,7 @@ var _ = Describe("Running Starter in damon mode", func() {
It("should respond with all the supported files", func() {
resp, err := resty.R().Get("http://127.0.0.1:9090/analyze/supported")
Expect(err).NotTo(HaveOccurred())
Expect(string(resp.Body())).To(Equal(`{"Languages":[{"Name":"ruby","Files":["Gemfile","Procfile","config/database.yml"],"SupportedVersion":null},{"Name":"node","Files":["package.json","Procfile"],"SupportedVersion":["0.10.46","0.12.15","4.5.0","5.12.0","6.6.0"]},{"Name":"php","Files":["composer.json"],"SupportedVersion":null}]}`))
Expect(string(resp.Body())).To(Equal(`{"Languages":[{"Name":"ruby","Files":["Gemfile","Procfile","config/database.yml"],"SupportedVersion":null},{"Name":"node","Files":["package.json","Procfile",".meteor/release"],"SupportedVersion":["4.5.0"]},{"Name":"php","Files":["composer.json"],"SupportedVersion":null}]}`))
})
})

Expand Down Expand Up @@ -226,7 +226,7 @@ var _ = Describe("Running Starter in damon mode", func() {
analysis.LanguageVersion = "4.5.0"
analysis.Framework = "express"
analysis.FrameworkVersion = "4.13.0"
analysis.SupportedLanguageVersions = []string{"0.10.46", "0.12.15", "4.5.0", "5.12.0", "6.6.0"}
analysis.SupportedLanguageVersions = []string{"4.5.0"}
analysis.Warnings = nil
analysis.Dockerfile = string(file)
analysis.StartCommands = []string{"node server.js"}
Expand All @@ -249,10 +249,10 @@ var _ = Describe("Running Starter in damon mode", func() {
analysis := analysisResult{}
analysis.Ok = true
analysis.Language = "node"
analysis.LanguageVersion = "0.10.46"
analysis.LanguageVersion = "4.5.0"
analysis.Framework = "express"
analysis.FrameworkVersion = "4.14.0"
analysis.SupportedLanguageVersions = []string{"0.10.46", "0.12.15", "4.5.0", "5.12.0", "6.6.0"}
analysis.SupportedLanguageVersions = []string{"4.5.0"}
analysis.Warnings = []string{"No Procfile was detected. It is strongly advised to add one in order to specify the commands to run your services."}
analysis.Dockerfile = string(file)
analysis.StartCommands = []string{"npm start"}
Expand Down
14 changes: 6 additions & 8 deletions build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
build:
version: 2016-02-13 #version
steps:
tester:
name: tester
dockerfile: Dockerfile.tester
command: go test
crosscompile:
name: crosscompile
depends_on:
- tester
dockerfile: Dockerfile.crosscompile
artifacts:
- /usr/local/go/src/github.com/cloud66/starter/compiled/starter_darwin_386:./artifacts/compiled
Expand All @@ -17,5 +11,9 @@ build:
- /usr/local/go/src/github.com/cloud66/starter/compiled/starter_windows_amd64.exe:./artifacts/compiled
- /usr/local/go/src/github.com/cloud66/starter/compiled/starter_linux_386:./artifacts/compiled
- /usr/local/go/src/github.com/cloud66/starter/compiled/starter_linux_amd64:./artifacts/compiled


- /usr/local/go/src/github.com/cloud66/starter/compiled/starter:./artifacts/compiled
runtime:
name: runtime
depends_on:
- crosscompile
dockerfile: Dockerfile.production
14 changes: 5 additions & 9 deletions cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,25 @@ package main_test

import (
"fmt"
"bytes"
"time"
"os/exec"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"os/exec"
"time"
)


var helpText string
var versionText string

var _ = Describe("Running Starter", func() {

BeforeEach(func() {
command := exec.Command("git", "describe", "--abbrev=0", "--tags")
command_out, _ := command.Output()
version := bytes.TrimRight(command_out, "\n")
version := "test"
current_date := time.Now().Format("2006-01-02")

helpText = fmt.Sprintf("Starter (%s) Help\n", version)
versionText = fmt.Sprintf("Starter version: %s (%s)\n", version, current_date)
})

})

Context("using the help flag", func() {
It("should show the help", func() {
Expand Down
4 changes: 2 additions & 2 deletions codeship-steps.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- name: test_step
- name: test
service: starter
command: go test
command: go test -ginkgo.failFast -ginkgo.seed=1
7 changes: 7 additions & 0 deletions common/utils-git.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ import (
"path/filepath"
"strings"
)
func HasGit(dir string) bool {
_, err := GitRootDir(dir)
if err != nil {
return false
}
return true
}

func LocalGitBranch(dir string) string {
gitRootDir, err := GitRootDir(dir)
Expand Down
3 changes: 2 additions & 1 deletion compile.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/bin/bash
gox -ldflags "-X main.BUILD_DATE=`date -u '+%Y-%m-%d'` -X main.VERSION=`git describe --abbrev=0 --tags`" -osarch="darwin/386 darwin/amd64 linux/386 linux/amd64 windows/386 windows/amd64" -output="compiled/{{.Dir}}_{{.OS}}_{{.Arch}}"
gox -ldflags "-X main.BUILDDATE=`date -u '+%Y-%m-%d'` -X main.VERSION=1.0.2" -osarch="darwin/386 darwin/amd64 linux/386 linux/amd64 windows/386 windows/amd64" -output="compiled/{{.Dir}}_{{.OS}}_{{.Arch}}"
CGO_ENABLED=0 gox -ldflags "-X main.BUILDDATE=`date -u '+%Y-%m-%d'` -X main.VERSION=1.0.2" -osarch="linux/amd64" -output="compiled/starter"
6 changes: 2 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ starter:
build: .
volumes:
- ${PWD}:/usr/local/go/src/github.com/cloud66/starter
- ${HOME}/.docker/machine/machines/default:/usr/local/docker/default
environment:
- DOCKER_HOST=$DOCKER_HOST
- DOCKER_CERT_PATH=/usr/local/docker/default
ports:
- 9091:9090
Loading

0 comments on commit d5a32e9

Please sign in to comment.