Improve error handling and SDK error testing. The code now includes signal handling, error wrapping, checking for contained errors, and testing HTTP error responses. Additionally, assertions have been added to ensure the expected behavior is met.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* fix(errors): Fix nil pointer error in NewSDKError
In the NewSDKError function, a check is added to handle the case where the input error is nil. Previously, if the error was nil, the function would panic. This fix ensures that the function returns nil instead of panicking when the input error is nil.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(sdk-mock): Add mock functions for SDK testing
This commit adds a set of mock functions for the software development kit (SDK) to facilitate testing. These functions simulate the behavior of the actual functions in the SDK and have defined input parameters and return values. The code also includes error handling logic and checks for different return types.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* test: use sdk mocked interface
* feat(workflow): check for generated files
The commit modifies the check-proto GitHub workflow to check-generated files. It checks for changes in specific paths and verifies the protobuf files and generated mocks. The code also includes checking if the SDK mock is up to date, installing a tool, generating mocks, and displaying an error message if the mocks are different. The tool we use is: https://github.com/vektra/mockery.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(mocks): Add copyright notice to mocks.go
Added a copyright notice to the mocks.go file in the pkg/sdk/go directory for clarity and attribution.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(build): Add target for generating mocks
Added a new target to the Makefile for generating mocks using the mockery tool. The target checks if the mockery tool is installed and then runs the "go generate" command to generate mocks for the codebase..
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Improve error messages in check-generated-files.yml
In this commit, I have made changes to the check-generated-files.yml file. Specifically, I have updated the error messages to provide more information about the issue. Instead of simply stating that the proto file and generated Go file are out of sync, the error message now includes a more detailed explanation and a suggestion for resolving the issue. Additionally, I have also added error messages for the generated mocks for the SDK. These error messages provide information about the sync issue and suggest running the necessary commands to resolve it. This commit aims to improve the clarity of error messages and help developers quickly identify and fix sync issues in the codebase.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* chore(license): update copyright notices
Add CI check for non go files to check that the files contain a license
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* fix(ci): log failed files
When the CI fails during check for license header, log the failed file to console so that someone can check on the actual file. Also simplify the grep check to make it more human readable and understandable
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
fix: comment formt
fix: CI error
change to mf errors
change to lowercase in error first word
fix: send message test case
remove: unused const
Signed-off-by: Arvindh <arvindh91@gmail.com>