Skip to content
This repository has been archived by the owner on Jul 7, 2020. It is now read-only.

Commit

Permalink
Add remote integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekSi committed Feb 6, 2013
1 parent 8bc3df4 commit a801f9a
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Makefile
@@ -1,4 +1,4 @@
all: test
all: integration_test_short

prepare:
go env
Expand All @@ -17,9 +17,10 @@ test: fvb
cd ../test_nut1 && ../nut/gonut pack
go test -v github.com/AlekSi/nut -gocheck.v
go test -v github.com/AlekSi/nut/nut -gocheck.v
go test -v github.com/AlekSi/nut/integration_test -gocheck.v
go test -v -short github.com/AlekSi/nut/integration_test -gocheck.v

test_server: test
cd ../test_nut1 && GONUTS_IO_SERVER=localhost:8080 ../nut/gonut publish -v test_nut1-0.0.1.nut
cd ../test_nut2 && GONUTS_IO_SERVER=localhost:8080 ../nut/gonut publish -v test_nut2-0.0.2.nut
cd ../test_nut1 && GONUTS_IO_SERVER=localhost:8080 ../nut/gonut get -v test_nut2/0.0.2
integration_test_short: test
go test -v -short github.com/AlekSi/nut/integration_test -gocheck.v

integration_test: test
GONUTS_IO_SERVER=localhost:8080 go test -v github.com/AlekSi/nut/integration_test -gocheck.v
52 changes: 52 additions & 0 deletions integration_test/remote_test.go
@@ -0,0 +1,52 @@
package integration_test

import (
"strings"
"testing"

. "launchpad.net/gocheck"
)

type R struct{}

var _ = Suite(&R{})

func (*R) SetUpTest(c *C) {
for _, dir := range []string{TestNut1, TestNut2, TestNut3} {
runCommand(c, dir, "git", "reset --hard origin/master")
runCommand(c, dir, "git", "clean -xdf")
}
}

func (r *R) TearDownTest(c *C) {
r.SetUpTest(c)
}

func (*R) TestPublishGet(c *C) {
if testing.Short() {
c.Skip("-short passed")
}

_, stderr := runNut(c, TestNut1, "pack -v")
c.Check(strings.HasSuffix(stderr, `test_nut1-0.0.1.nut created.`), Equals, true)
gitNoDiff(c, TestNut1)

_, stderr = runNut(c, TestNut2, "pack -v")
c.Check(strings.HasSuffix(stderr, `test_nut2-0.0.2.nut created.`), Equals, true)
gitNoDiff(c, TestNut2)

_, stderr = runNut(c, TestNut1, "publish -v test_nut1-0.0.1.nut")
c.Check(strings.HasSuffix(stderr, `Nut "test_nut1" version "0.0.1" published.`), Equals, true)
gitNoDiff(c, TestNut1)

_, stderr = runNut(c, TestNut1, "publish -v test_nut1-0.0.1.nut", 1)
c.Check(strings.HasSuffix(stderr, `Nut "test_nut1" version "0.0.1" already exists.`), Equals, true)
gitNoDiff(c, TestNut1)

_, stderr = runNut(c, TestNut2, "publish -v test_nut2-0.0.2.nut")
c.Check(strings.HasSuffix(stderr, `Nut "test_nut2" version "0.0.2" published.`), Equals, true)
gitNoDiff(c, TestNut2)

// _, stderr = runNut(c, "", "get -v test_nut2/0.0.2")
// c.Check(strings.HasSuffix(stderr, `Nut "test_nut2" version "0.0.2" published.`), Equals, true)
}

0 comments on commit a801f9a

Please sign in to comment.