Skip to content

Commit

Permalink
Merge branch 'transaction-pooling' of https://github.com/ubclaunchpad…
Browse files Browse the repository at this point in the history
…/cumulus into transaction-pooling
  • Loading branch information
chadlagore committed Jun 17, 2017
2 parents 17d0970 + 92017a8 commit 09e979e
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.PHONY: test deps clean install_glide

PACKAGES = `go list ./... | grep -v vendor/`

all: cumulus
Expand Down
12 changes: 9 additions & 3 deletions glide.lock

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

6 changes: 6 additions & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ import:
- package: github.com/Sirupsen/logrus
- package: github.com/spf13/cobra
- package: github.com/spf13/pflag
- package: github.com/onsi/ginkgo
version: ^1.3.1
subpackages:
- ginkgo
- package: github.com/onsi/gomega
version: ^1.1.0
13 changes: 13 additions & 0 deletions test/cumulus_suite_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"testing"
)

func TestCumulus(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Cumulus Suite")
}
33 changes: 33 additions & 0 deletions test/initialization.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package test

import (
"os/exec"
"strconv"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/ubclaunchpad/cumulus/conn"
"github.com/ubclaunchpad/cumulus/peer"
)

var _ = Describe("Initialization", func() {
var instance *exec.Cmd

BeforeEach(func() {
var err error
instance, err = startInstance()
Expect(err).ToNot(HaveOccurred())
})

AfterEach(func() {
if instance.Process != nil {
instance.Process.Kill()
}
})

// TODO fails until new peer implementation is merged in
PIt("should accept a TCP connection", func() {
_, err := conn.Dial(peer.DefaultIP + ":" + strconv.Itoa(peer.DefaultPort))
Expect(err).ToNot(HaveOccurred())
})
})
29 changes: 29 additions & 0 deletions test/utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package test

import (
"fmt"
"os"
"os/exec"
)

func startInstance() (*exec.Cmd, error) {
fmt.Println("start instance")
install := exec.Command("go", "install")
install.Dir = "."

if out, err := install.CombinedOutput(); err != nil {
return nil, err
} else if len(out) != 0 {
// Successful go install is silent
return nil, fmt.Errorf(string(out))
}

app := exec.Command("cumulus", "run")
app.Stdout = os.Stdout
app.Stderr = os.Stderr

fmt.Println("about to start")
err := app.Start()
fmt.Println("started")
return app, err
}

0 comments on commit 09e979e

Please sign in to comment.