-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SnapshotCreate and SnapshotGet for FCD (#344)
* Snapshot create for FCD * SnapshotGet implementation * Add more error check and test * Nil check in conversion functions * Make error messages consistent
- Loading branch information
1 parent
afdf547
commit d8d0d0b
Showing
4 changed files
with
132 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package vmware | ||
|
||
import ( | ||
. "gopkg.in/check.v1" | ||
) | ||
|
||
type VMWareConversionSuite struct{} | ||
|
||
var _ = Suite(&VMWareConversionSuite{}) | ||
|
||
func (s *VMWareConversionSuite) TestSnapshotIDConversion(c *C) { | ||
for _, tc := range []struct { | ||
fullID string | ||
errCheck Checker | ||
}{ | ||
{ | ||
fullID: "1234-abcd-5678-9213:3413-abcd-1234-1234", | ||
errCheck: IsNil, | ||
}, | ||
{ | ||
fullID: "1234-abcd-5678-9213:", | ||
errCheck: NotNil, | ||
}, | ||
{ | ||
fullID: ":3413-abcd-1234-1234", | ||
errCheck: NotNil, | ||
}, | ||
{ | ||
fullID: "1234-abcd-5678-9213", | ||
errCheck: NotNil, | ||
}, | ||
} { | ||
volID, snapID, err := splitSnapshotFullID(tc.fullID) | ||
c.Check(err, tc.errCheck) | ||
if tc.errCheck == IsNil { | ||
fullID := snapshotFullID(volID, snapID) | ||
c.Check(tc.fullID, Equals, fullID) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package vmware | ||
|
||
import ( | ||
"testing" | ||
|
||
. "gopkg.in/check.v1" | ||
) | ||
|
||
func Test(t *testing.T) { TestingT(t) } |