-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
begin to add tests for apis/storage/v1alpha
#36
Conversation
e74bb38
to
9b7c610
Compare
9b7c610
to
8118132
Compare
8118132
to
97afe56
Compare
…v1alpha * origin/master: (145 commits) Enable LONG on kube-arangodb-long test fix rocksdb_encryption_test fix - /api/version will answer on all servers (not leader only) fixes required after merge add downgrade tests add missing uniuri Merged in master Fixed unit-test packages Fixed unit tests Do not Fail the deployment, unless there is REALLY no other way Updated tests Refactor DeploymentState to DeploymentPhase Revert example change Added detection on unschedulable pods Detect pods not being scheduled Same fix on ArangoLocalStorage AsOwner no longer things the owner refers to a controller. It refers to the ArangoDeployment disable upgrade tests to 3.4 until 3.4 is available on hub.docker.com Listen for secret changes Log improvements ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments about underscores and assert.Error
.. apply to all tests.
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func Test_LocalStorageSpec_Creation(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid the use of underscore in member names.
) | ||
|
||
func Test_LocalStorageSpec_Creation(t *testing.T) { | ||
var ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop this and do something like class := ...
on first use
|
||
class = StorageClassSpec{"SpecName", true} | ||
local = LocalStorageSpec{StorageClass: class, LocalPath: []string{""}} | ||
err = local.Validate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't understand this and the next line.
Probably you want to use assert.Error
or assert.NoError
see https://godoc.org/github.com/stretchr/testify/assert#Error
assert.Equal(t, errors.Cause(class.Validate()), errors.Cause(err)) | ||
|
||
class = StorageClassSpec{"spec-name", true} | ||
local = LocalStorageSpec{StorageClass: class, LocalPath: []string{""}} //is this allowed - should the paths be checked? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably indicates a bug.
assert.True(t, nil != storageClassSpec.Validate()) | ||
|
||
storageClassSpec = StorageClassSpec{Name: "TheSpecName", IsDefault: true} // no upper-case allowed | ||
assert.True(t, nil != storageClassSpec.Validate()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.Error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of small issues
|
||
class := StorageClassSpec{"SpecName", true} | ||
local := LocalStorageSpec{StorageClass: class, LocalPath: []string{""}} | ||
err := local.Validate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge with line 39.
assert.Error(t, local.Validate())
class = StorageClassSpec{"spec-name", true} | ||
local = LocalStorageSpec{StorageClass: class, LocalPath: []string{}} | ||
err = local.Validate() | ||
assert.Equal(t, ValidationError, errors.Cause(err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.IsTrue(t, IsValidation(err))
) | ||
|
||
func TestArangoLocalStorageCreation(t *testing.T) { | ||
assert.True(t, false, "test needs to be implemented") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO???
|
||
assert.Equal(t, "target", specTarget.Name) | ||
rv := specSource.ResetImmutableFields("fieldPrefix-", &specTarget) | ||
assert.Equal(t, "fieldPrefix-name", strings.Join(rv[:], ", ")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go: no need for rv[:]
, just rv
is enough here
f0b34b4
to
04305ef
Compare
04305ef
to
8a59df6
Compare
|
||
// test creation of arango local storage | ||
func TestArangoLocalStorageCreation(t *testing.T) { | ||
// REVIEW - is there something more meaningful to test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this is testing go and not our code.
I suggest to drop it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to drop as in comment, after that merge it
tests for
apis/storage/v1alpha
part of issue #33