-
Notifications
You must be signed in to change notification settings - Fork 14
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
Include Test case for Limits #83
Conversation
0e55657
to
60bd9d0
Compare
7e43851
to
3dbb296
Compare
Can we run the workflow again? The issue is same as #82 where mostly failure happens for logs. |
tests/deploy_test.go
Outdated
} else if config.ProviderName == faasdProviderName && deploy.Limits != nil && status.Limits != nil { | ||
deployLimits := *deploy.Limits | ||
statusLimits := *status.Limits | ||
if deployLimits.Memory != statusLimits.Memory { |
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.
I would like to see this fail for the current version of faasd which has no memory limit support in its status endpoint.
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.
Changes are done. Since faasd does not support cpu, special handling is required for faasd.
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.
Changes are done to allow current stable faasd version to fail for Limits
3dbb296
to
e1be244
Compare
d098bdc
to
453cf64
Compare
You can run this locally with |
453cf64
to
dd31ba4
Compare
Perfect! |
We now have a new release which populates the memory value in the API, so let's run these tests again once the binaries are ready. After that, if the faasd tests pass, I'll merge this PR. |
Can we run it now? I don't have permission for same. |
dd31ba4
to
731e6a0
Compare
731e6a0
to
b76169b
Compare
@alexellis @LucasRoesler I have removed faasd memory test for now and have kept it just for faas-netes. Will work on it once we have resolved openfaas/faasd#228 |
b76169b
to
c0e539f
Compare
tests/deploy_test.go
Outdated
Labels: &map[string]string{}, | ||
Namespace: config.DefaultNamespace, | ||
Limits: &types.FunctionResources{ | ||
Memory: "5M", |
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.
Could you try this with 5Mi
?
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.
Changes are done and it works for both faas-netes and faasd.
c0e539f
to
599952d
Compare
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.
@nitishkumar71 i added a comment about improving the readability of the test by using a new config flag instead of the provider name.
Another approach could be to have a function SupportsCPULimits(name string) bool
that takes the provider name and returns true if it is in the supported list. But either way, using the provider name in the control flow is going to be a bit fragile in the long term.
tests/deploy_test.go
Outdated
if config.ProviderName != faasdProviderName && !reflect.DeepEqual(deploy.Limits, status.Limits) { | ||
return fmt.Errorf("got %v, expected Limits %v", status.Limits, deploy.Limits) | ||
} else if config.ProviderName == faasdProviderName && deploy.Limits != nil { | ||
if status.Limits == nil { | ||
return fmt.Errorf("got nil, expected Limits %v", deploy.Limits) | ||
} | ||
if deploy.Limits.Memory != status.Limits.Memory { | ||
return fmt.Errorf("got %s, expected Requested Limit %s", status.Limits.Memory, deploy.Limits.Memory) | ||
} |
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.
If i am reading this correctly, this implies that faasd does not record and therfore can not return the CPU limits from the original function deployment, is that correct?
I think we can make this semantically clearer and easier to maintain by adding a new boolean value to the config config.SupportCPULimits
. When the test starts, we can set config.SupportCPULimits = config.ProviderName != faasdProviderName
in the main_test.go
I would then split this into two tests, one for memory and one for CPU
if config.ProviderName != faasdProviderName && !reflect.DeepEqual(deploy.Limits, status.Limits) { | |
return fmt.Errorf("got %v, expected Limits %v", status.Limits, deploy.Limits) | |
} else if config.ProviderName == faasdProviderName && deploy.Limits != nil { | |
if status.Limits == nil { | |
return fmt.Errorf("got nil, expected Limits %v", deploy.Limits) | |
} | |
if deploy.Limits.Memory != status.Limits.Memory { | |
return fmt.Errorf("got %s, expected Requested Limit %s", status.Limits.Memory, deploy.Limits.Memory) | |
} | |
if deploy.Limits != nil { | |
if status.Limits == nil { | |
return fmt.Errorf("got nil, expected Limits %v", deploy.Limits) | |
} | |
if deploy.Limits.Memory != status.Limits.Memory { | |
return fmt.Errorf("got %s, expected Requested Limit %s", status.Limits.Memory, deploy.Limits.Memory) | |
} | |
if config.SupportCPULimits && deploy.Limits.CPU != status.Limits.CPU { | |
return fmt.Errorf("got %s, expected Requested Limit %s", status.Limits.CPU, deploy.Limits.CPU) | |
} | |
} | |
if deploy.Limits == nil && status.Limits != nil { | |
return fmt.Errorf("got %s, expected nil", status.Limits) | |
} |
I think using a config flag here makes the intent of the test much clearer and generic.
In general, I prefer the tests to mention features not providers.
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.
Thank you for suggestion. No doubt this is the best way to write the code. There is an issue in faasd due to which below lines will not work for functions for which no memory limit is explicitly set.
if deploy.Limits == nil && status.Limits != nil {
return fmt.Errorf("got %s, expected nil", status.Limits)
}
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.
These changes will work only after merge and release of openfaas/faasd#232. I have validated these changes in my local.
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.
@nitishkumar71 now that openfaas/faasd#232 is merged, what do we need to do to merge this?
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.
I think you need to force push again to trigger the actions to re-run the tests
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
f02b179
to
573afad
Compare
00a0232
to
daf52e0
Compare
Signed-off-by: Nitishkumar Singh <[email protected]> Test case changed to binary SI from decimal SI Signed-off-by: Nitishkumar Singh <[email protected]> Included Suggestions Signed-off-by: Nitishkumar Singh <[email protected]> Prefixed Docker registery path Signed-off-by: Nitishkumar Singh <[email protected]> revrted wait part Signed-off-by: Nitishkumar Singh <[email protected]>
daf52e0
to
8d53e82
Compare
I am going to merge this because the test that is failing is the scaling test, which has been flaky and we are still investigating. The new limits test is fine |
Signed-off-by: Nitishkumar Singh [email protected]
Certifier should support validation of memory limit in faasd and openfaas
Description
Motivation and Context
Closes #81
How Has This Been Tested?
Types of changes
Checklist:
Commits:
git commit -s
for the Developer Certificate of Origin (DCO)Code:
Docs: