Skip to content
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

fix(CI): add the job to run go test on the KubeArmor/KubeArmor directory #1267

Merged
merged 1 commit into from
Jun 29, 2023

Conversation

haytok
Copy link
Contributor

@haytok haytok commented Jun 14, 2023

The current implementation does not have a job in CI to run tests for golang programs under the KubeArmor/KubeArmor directory.

Therefore, this commit will add the job to ci-test-go.yml to run tests for golang programs under the KubeArmor/KubeArmor directory.

Purpose of PR?:

Fixes #

I haven't created an issue. However, in the pull request #1264 , we were advised to add a CI to run tests of golang programs under KubeArmor/KubeArmor directory. Specifically, this part is applicable.

Does this PR introduce a breaking change?

No.
I added a job to ci-test-go.yml with this commit.

If the changes in this PR are manually verified, list down the scenarios covered::

In the CI job, tests of golang programs can be run in the KubeArmor/KubeArmor directory.

Additional information for reviewer? :
Mention if this PR is part of any design or a continuation of previous PRs

Attached below is a screenshot of running the job I added in my verification environment.

image

Note that at the moment, the test fails at the process in KubeArmor/KubeArmor/core/karmorprobedata.go:61:17 as shown in the image. I will try to fix this in another pull request.

Checklist:

  • Bug fix. Fixes #
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • PR Title follows the convention of <type>(<scope>): <subject>
  • Commit has unit tests
  • Commit has integration tests

@rksharma95
Copy link
Collaborator

hey @haytok thanks for this PR, can you please handle the failing issue with this PR itself? thanks again.

@haytok
Copy link
Contributor Author

haytok commented Jun 20, 2023

Hi, @rksharma95
Thank you for your comment!
I have fixed the above issue so that the test (ci-test-go/go-test) by go test passes.

@rksharma95
Copy link
Collaborator

@haytok PR LGTM, can you please squash the commits. thanks

…ory and fix to pass the tests

The current implementation does not have a job in CI to run tests for
golang programs under the KubeArmor/KubeArmor directory.

Therefore, this commit will add the job to ci-test-go.yml to run tests for
golang programs under the KubeArmor/KubeArmor directory.

On the other hand, in the current implementation, the following error
occurs when go test is executed in the directory KubeArmor/KubeArmor/core.

  > go test
  # github.com/kubearmor/KubeArmor/KubeArmor/core
  ./karmorprobedata.go:61:3: (*github.com/kubearmor/KubeArmor/KubeArmor/feeder.Feeder).Errf format %s reads arg kubearmor#1, but call has 0 args

Thus, if test_kubearmor.sh or go test ./... on the kubearmor/kubeArmor are
run, the test will fail.

The test fails because dm.Logger.Errf(), which is called in the
SetKarmorData function in the file core/karmorprobedata.go, is missing an
argument for the format specifier.

Therefore, this commit will fix it to add a variable for the format
specifiers so that the test will succeed properly.

Signed-off-by: Hayato Kiwata <simplelpmis6@gmail.com>
@haytok haytok force-pushed the fix-to-run-golang-tests-on-ci branch from 27a6b4f to 87f99c9 Compare June 23, 2023 12:37
@haytok
Copy link
Contributor Author

haytok commented Jun 23, 2023

@rksharma95
Thank you for your comment !!!
I have squashed the two commits.
Could you please review when you have time?

Copy link
Collaborator

@rksharma95 rksharma95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@daemon1024 daemon1024 merged commit 73ae18a into kubearmor:main Jun 29, 2023
13 checks passed
@haytok
Copy link
Contributor Author

haytok commented Jun 29, 2023

Thanks for merge :)

@haytok haytok deleted the fix-to-run-golang-tests-on-ci branch June 29, 2023 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants