-
Notifications
You must be signed in to change notification settings - Fork 243
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
add unit test for CreatePVC #499
Conversation
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.
few changes requested
pkg/occlient/occlient_test.go
Outdated
// Checks for return values in positive cases | ||
if err == nil { | ||
createdPVC := fkclientset.Kubernetes.Actions()[0].(ktesting.CreateAction).GetObject().(*corev1.PersistentVolumeClaim) | ||
// fmt.Println(createdPVC) |
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.
remove this line
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.
done
pkg/occlient/occlient_test.go
Outdated
if !reflect.DeepEqual(createdPVC.Labels, tt.labels) { | ||
t.Errorf("labels in created route is not matching expected labels, expected: %v, got: %v", tt.labels, createdPVC.Labels) | ||
} | ||
// name and size that route is pointg to should match |
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.
pointg -> pointing
pkg/occlient/occlient_test.go
Outdated
// name and size that route is pointg to should match | ||
// if createdPVC.Size != tt.size { | ||
// t.Errorf("route is not matching to expected service name, expected: %s, got %s", tt.size, createdPVC.Size) | ||
// } |
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.
remove these lines of code?
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.
sorry this is a WIP and i still have to add checks for the size of createdPVC
@syamgk You need to add a description to all your commit messages as well! It helps when generating a changelog. |
pkg/occlient/occlient_test.go
Outdated
// Checks for error in positive cases | ||
if !tt.wantErr == (err != nil) { | ||
t.Errorf(" client.CreatePVC(name, size, labels) unexpected error %v, wantErr %v", err, tt.wantErr) | ||
return |
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.
no need to call return here.
pkg/occlient/occlient_test.go
Outdated
// Checks for return values in positive cases | ||
if err == nil { | ||
createdPVC := fkclientset.Kubernetes.Actions()[0].(ktesting.CreateAction).GetObject().(*corev1.PersistentVolumeClaim) | ||
quantity, _ := resource.ParseQuantity(tt.size) |
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.
errors shouldn't be ignored
labels map[string]string | ||
wantErr bool | ||
}{ | ||
{ |
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.
there should also be some tests that result in error. For example invalid size
value
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.
added one error case
add unit test for CreatePVC function
add unit-test for CreatePVC