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

feat: add lj-releng tool to check Lua code for finding the potential problems #5624

Merged
merged 1 commit into from
May 30, 2020

Conversation

agile6v
Copy link
Contributor

@agile6v agile6v commented May 30, 2020

What this PR does / why we need it:

Introduce lj-releng tool to check the Lua code for finding the potential problems.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Which issue/s this PR fixes

fixes #5577

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 30, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @agile6v. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 30, 2020
@agile6v
Copy link
Contributor Author

agile6v commented May 30, 2020

@aledbf @ElvinEfendi

There's few things to do.

Build the e2e image based on the latest commit. If you've built the latest e2e image, please let me know.

Then I'll submit another PR to enable the lj-releng tool.

  1. Update the version of the e2e image in build/run-in-docker.sh file.
  2. Fix all errors with lj-releng tool tips.

Thanks.

@agile6v
Copy link
Contributor Author

agile6v commented May 30, 2020

Changes in the File hack/verify-lualint.sh may cause the CI to fail. Put it into the next PR?

@aledbf
Copy link
Member

aledbf commented May 30, 2020

@agile6v yes, please create a different PR with the changes to the verify-lualint.sh file

@aledbf
Copy link
Member

aledbf commented May 30, 2020

@agile6v please squash the commits

@aledbf
Copy link
Member

aledbf commented May 30, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 30, 2020
@aledbf
Copy link
Member

aledbf commented May 30, 2020

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 30, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: agile6v, aledbf

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 30, 2020
@k8s-ci-robot k8s-ci-robot merged commit 734f385 into kubernetes:master May 30, 2020
@aledbf
Copy link
Member

aledbf commented Jun 1, 2020

@agile6v please open the other PR to use the new tool

@agile6v
Copy link
Contributor Author

agile6v commented Jun 2, 2020

@agile6v please open the other PR to use the new tool

OK. I found ngx-lua-module and busted(unit test) work together not so smoothly, so I need to solve it first.

For example:

If added the code local ngx = ngx to the util.lua file, then run the Lua unit test. Got the error API disabled in the current context. This error is correct, but we should suppress it.

Thanks.

@aledbf
Copy link
Member

aledbf commented Jun 2, 2020

@ElvinEfendi ^^

@ElvinEfendi
Copy link
Member

ElvinEfendi commented Jun 3, 2020

@agile6v are you sure the error is because of local ngx = ngx? We use resty to run the tests, where ngx is available. Maybe you are accessing ngx API that is not available in timer phase?

See

.

You can also introduce some more helpers in test/helpers.lua for mocking that is exposed in

_G.helpers = require("test.helpers")
.

@agile6v we can discuss this further in Kubernetes slack if you are there.

@agile6v
Copy link
Contributor Author

agile6v commented Jun 4, 2020

@agile6v are you sure the error is because of local ngx = ngx? We use resty to run the tests, where ngx is available. Maybe you are accessing ngx API that is not available in timer phase?

See

Hi @ElvinEfendi It should be caused by the order of mock ngx table and require module. There are some files that need to be modified and i'm modified them one by one. Not sure this is the best solution.

You can also introduce some more helpers in test/helpers.lua for mocking that is exposed in

_G.helpers = require("test.helpers")

.
@agile6v we can discuss this further in Kubernetes slack if you are there.

OK. I'm on slack with the same as the github ID.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce lj-releng tool to check the Lua code.
4 participants