Skip to content

Commit

Permalink
fixing issue 5
Browse files Browse the repository at this point in the history
  • Loading branch information
ezraroi committed Jan 15, 2018
1 parent 44e9bf8 commit 2c3299f
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 15 deletions.
12 changes: 6 additions & 6 deletions Dockerfile
@@ -1,11 +1,11 @@
FROM golang:alpine as builder
COPY . /go/src/github.com/regevbr/keyval-resource
COPY . /go/src/github.com/SWCE/keyval-resource
ENV CGO_ENABLED 0
ENV GOPATH /go/src/github.com/regevbr/keyval-resource/Godeps/_workspace:${GOPATH}
ENV PATH /go/src/github.com/regevbr/keyval-resource/Godeps/_workspace/bin:${PATH}
RUN go build -o /assets/out github.com/regevbr/keyval-resource/out
RUN go build -o /assets/in github.com/regevbr/keyval-resource/in
RUN go build -o /assets/check github.com/regevbr/keyval-resource/check
ENV GOPATH /go/src/github.com/SWCE/keyval-resource/Godeps/_workspace:${GOPATH}
ENV PATH /go/src/github.com/SWCE/keyval-resource/Godeps/_workspace/bin:${PATH}
RUN go build -o /assets/out github.com/SWCE/keyval-resource/out
RUN go build -o /assets/in github.com/SWCE/keyval-resource/in
RUN go build -o /assets/check github.com/SWCE/keyval-resource/check
RUN set -e; for pkg in $(go list ./...); do \
go test -o "/tests/$(basename $pkg).test" -c $pkg; \
done
Expand Down
2 changes: 1 addition & 1 deletion check/check_test.go
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/onsi/gomega/gexec"

"github.com/regevbr/keyval-resource/models"
"github.com/SWCE/keyval-resource/models"
"github.com/onsi/gomega/gbytes"
)

Expand Down
2 changes: 1 addition & 1 deletion check/main.go
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"os"

"github.com/regevbr/keyval-resource/models"
"github.com/SWCE/keyval-resource/models"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion in/in_test.go
Expand Up @@ -8,7 +8,7 @@ import (
"path"
//"path/filepath"

"github.com/regevbr/keyval-resource/models"
"github.com/SWCE/keyval-resource/models"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
Expand Down
2 changes: 1 addition & 1 deletion in/main.go
Expand Up @@ -6,7 +6,7 @@ import (
"path/filepath"
"strconv"

"github.com/regevbr/keyval-resource/models"
"github.com/SWCE/keyval-resource/models"
"fmt"
"bufio"
"sort"
Expand Down
9 changes: 6 additions & 3 deletions out/main.go
Expand Up @@ -6,9 +6,11 @@ import (
"path/filepath"
"strconv"

"github.com/regevbr/keyval-resource/models"
"github.com/SWCE/keyval-resource/models"
"github.com/magiconair/properties"
"github.com/google/uuid"
"fmt"
"time"
)

func main() {
Expand All @@ -28,8 +30,9 @@ func main() {
if request.Params.File != "" {
inputFile := filepath.Join(destination, request.Params.File)
log("reading input file " + inputFile)
var data = properties.MustLoadFile(inputFile, properties.UTF8).Map();

var data = properties.MustLoadFile(inputFile, properties.UTF8).Map()
data["UPDATED"] = time.Now().Format(time.RFC850)
data["UUID"] = uuid.New().String()
log("read " + strconv.Itoa(len(data)) + " keys from input file")

json.NewEncoder(os.Stdout).Encode(models.OutResponse{
Expand Down
12 changes: 10 additions & 2 deletions out/out_test.go
Expand Up @@ -7,7 +7,7 @@ import (
"os"
"os/exec"
"path"
"github.com/regevbr/keyval-resource/models"
"github.com/SWCE/keyval-resource/models"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
Expand Down Expand Up @@ -86,6 +86,10 @@ var _ = Describe("Out", func() {
Expect(len(response.Version)).To(Equal(2))
Expect(response.Version["a"]).To(Equal("1"))
Expect(response.Version["b"]).To(Equal("2"))
Expect(response.Version).To(HaveKey("UPDATED"))
Expect(response.Version).To(HaveKey("UUID"))
Expect(response.Version["UPDATED"]).To(Not(BeEmpty()))
Expect(response.Version["UUID"]).To(Not(BeEmpty()))
})
})

Expand All @@ -103,7 +107,11 @@ var _ = Describe("Out", func() {
})

It("reports empty data", func() {
Expect(len(response.Version)).To(Equal(0))
Expect(len(response.Version)).To(Equal(2))
Expect(response.Version).To(HaveKey("UPDATED"))
Expect(response.Version).To(HaveKey("UUID"))
Expect(response.Version["UPDATED"]).To(Not(BeEmpty()))
Expect(response.Version["UUID"]).To(Not(BeEmpty()))
})
})

Expand Down

0 comments on commit 2c3299f

Please sign in to comment.