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

Commit

Permalink
Addressing Sam's comment + adding verbose outcome while running tests…
Browse files Browse the repository at this point in the history
… using gocheck
  • Loading branch information
shuklanirdesh82 committed May 17, 2017
1 parent 71d27d3 commit f531dd1
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 7 deletions.
8 changes: 4 additions & 4 deletions tests/constants/dockercli/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ const (
// ListVolumes to list down docker volumes
ListVolumes = dockerVol + "ls "

// Inspect to grab volume properties
Inspect = dockerVol + "inspect "
// InspectVolume to grab volume properties
InspectVolume = dockerVol + "inspect "

// Remove constant refers delete volume command
Remove = dockerVol + "rm "
// RemoveVolume constant refers delete volume command
RemoveVolume = dockerVol + "rm "
)
35 changes: 35 additions & 0 deletions tests/hello_test/hello1_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package hello_test

import (
"fmt"
"io"

. "gopkg.in/check.v1"
)

// Hook up gocheck into the "go test" runner.
// func Test(t *testing.T) { TestingT(t) }

type MySuite1 struct{}

var _ = Suite(&MySuite1{})

func (s *MySuite1) SetUpSuite(c *C) {
fmt.Print("hello from mysuite1")
}

func (s *MySuite1) SetUpTest(c *C) {
fmt.Print("hello from mysuite test ============")
}

func (s *MySuite1) TestHelloWorld_2(c *C) {
c.Assert(42, Equals, "42")
c.Assert(io.ErrClosedPipe, ErrorMatches, "io: .*on closed pipe")
c.Check(42, Equals, 42)
}

func (s *MySuite) TestHelloWorld_3(c *C) {
c.Assert(42, Equals, "42")
c.Assert(io.ErrClosedPipe, ErrorMatches, "boom io: .*on closed pipe")
c.Check(42, Equals, 42)
}
36 changes: 36 additions & 0 deletions tests/hello_test/hello_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package hello_test

import (
"fmt"
"io"
"testing"

. "gopkg.in/check.v1"
)

// Hook up gocheck into the "go test" runner.
func Test(t *testing.T) { TestingT(t) }

type MySuite struct{}

func (s *MySuite) SetUpSuite(c *C) {
fmt.Print("hello from mysuite")
}

func (s *MySuite) SetUpTest(c *C) {
fmt.Print("hello from mysuite test ============")
}

var _ = Suite(&MySuite{})

func (s *MySuite) TestHelloWorld(c *C) {
c.Assert(42, Equals, "42")
c.Assert(io.ErrClosedPipe, ErrorMatches, "io: .*on closed pipe")
c.Check(42, Equals, 42)
}

func (s *MySuite) TestHelloWorld_1(c *C) {
c.Assert("42", Equals, "42")
c.Assert(io.ErrClosedPipe, ErrorMatches, "io: .*on closed pipe")
c.Check(42, Equals, 42)
}
4 changes: 2 additions & 2 deletions tests/utils/verification/volumeproperties.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

// GetVMAttachedToVolUsingDockerCli returns attached to vm field of volume using docker cli
func GetVMAttachedToVolUsingDockerCli(volName string, hostname string) string {
cmd := dockercli.Inspect + " --format '{{index .Status \"attached to VM\"}}' " + volName
cmd := dockercli.InspectVolume + " --format '{{index .Status \"attached to VM\"}}' " + volName
op := ExecCmd(hostname, cmd)
if op == "" {
log.Fatal("Null value is returned by docker cli when looking for attached to vm field for volume. Output: ", op)
Expand Down Expand Up @@ -70,7 +70,7 @@ func GetVolumePropertiesAdminCli(volName string, hostname string) string {
// GetVolumePropertiesDockerCli returns capacity, attached-to-vm and disk-format field
// for volume using Docker cli
func GetVolumePropertiesDockerCli(volName string, hostname string) string {
cmd := dockercli.Inspect + " --format '{{index .Status.capacity.size}} {{index .Status.diskformat}} {{index .Status \"attached to VM\"}}' " + volName
cmd := dockercli.InspectVolume + " --format '{{index .Status.capacity.size}} {{index .Status.diskformat}} {{index .Status \"attached to VM\"}}' " + volName
op := ExecCmd(hostname, cmd)
expctedLen := 0
if op == "" {
Expand Down
2 changes: 1 addition & 1 deletion vmdk_plugin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ e2e-test:
.PHONY: e2e-dkrVolDriver-test
e2e-dkrVolDriver-test:
$(log_target)
$(GO) test $(E2E_Tests) -v
$(GO) test $(E2E_Tests) -check.v

MANAGED_PLUGIN_NAME="vsphere:latest"

Expand Down

0 comments on commit f531dd1

Please sign in to comment.