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

tests: General improvements to operator script #386

Merged

Conversation

GabyCT
Copy link
Contributor

@GabyCT GabyCT commented Jun 17, 2024

This PR gives general improvements to the operator script that is being used in tests. This PR includes changes like better variable definition and the use of a variable that has been already defined.

Copy link
Member

@fitzthum fitzthum left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@stevenhorsman stevenhorsman left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @GabyCT

Copy link
Contributor

@ldoktor ldoktor left a comment

Choose a reason for hiding this comment

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

Thanks, those are fine changes although shellcheck complains about more. Could you please take care of the others too since you are already treating style issues?

@GabyCT GabyCT force-pushed the topic/fixoperatorscript branch 2 times, most recently from f86a4a8 to 8891258 Compare June 25, 2024 22:45
@GabyCT
Copy link
Contributor Author

GabyCT commented Jun 25, 2024

changes applied


local pod_id="$(get_pods_regex $pod $op_ns)"
local pod_id
pod_id="$(get_pods_regex $pod $op_ns)"
Copy link
Contributor

Choose a reason for hiding this comment

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

The $pod and $op_ns should be quoted as well


local pod_id="$(get_pods_regex $pod $op_ns)"
local pod_id
pod_id="$(get_pods_regex $pod $op_ns)"
Copy link
Contributor

Choose a reason for hiding this comment

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

The same here

cmd+="egrep -q ${controller_pod}.*'\<Running\>'"
if ! wait_for_process 120 10 "$cmd"; then
echo "::error:: ${controller_pod} pod is not running"

local pod_id="$(get_pods_regex $controller_pod $op_ns)"
local pod_id
pod_id="$(get_pods_regex $controller_pod $op_ns)"
Copy link
Contributor

Choose a reason for hiding this comment

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

and here

@@ -132,12 +135,12 @@ install_ccruntime() {
local pod=""
local cmd=""
for pod in cc-operator-daemon-install cc-operator-pre-install-daemon; do
cmd="kubectl get pods -n "$op_ns" --no-headers |"
cmd="kubectl get pods -n $op_ns --no-headers |"
Copy link
Contributor

Choose a reason for hiding this comment

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

and here as well cmd="kubectl get pods -n '$op_ns' --no-headers |"

@@ -132,12 +135,12 @@ install_ccruntime() {
local pod=""
local cmd=""
for pod in cc-operator-daemon-install cc-operator-pre-install-daemon; do
cmd="kubectl get pods -n "$op_ns" --no-headers |"
cmd="kubectl get pods -n $op_ns --no-headers |"
cmd+="egrep -q ${pod}.*'\<Running\>'"
Copy link
Contributor

Choose a reason for hiding this comment

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

and here...

@GabyCT GabyCT force-pushed the topic/fixoperatorscript branch 2 times, most recently from a7b9fd5 to b4740ef Compare June 26, 2024 16:43
@@ -132,12 +135,12 @@ install_ccruntime() {
local pod=""
local cmd=""
for pod in cc-operator-daemon-install cc-operator-pre-install-daemon; do
cmd="kubectl get pods -n "$op_ns" --no-headers |"
cmd="kubectl get pods -n '$op_ns' --no-headers |"
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, this one is fine as it's a variable substitution, but ... (see below)


local pod_id="$(get_pods_regex $pod $op_ns)"
local pod_id
pod_id="$(get_pods_regex '$pod' '$op_ns')"
Copy link
Contributor

Choose a reason for hiding this comment

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

^^ unlike variable substitution in shell execution the expansion starts over inside $( ... ) therefore here you need to use " to expand the variables.


local pod_id="$(get_pods_regex $pod $op_ns)"
local pod_id
pod_id="$(get_pods_regex '$pod' '$op_ns')"
Copy link
Contributor

Choose a reason for hiding this comment

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

the same here, double quotes please

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ldoktor thanks for the feedback changes applied

@GabyCT GabyCT force-pushed the topic/fixoperatorscript branch from b4740ef to bd770b1 Compare July 1, 2024 19:09
cmd+="egrep -q ${controller_pod}.*'\<Running\>'"
if ! wait_for_process 120 10 "$cmd"; then
echo "::error:: ${controller_pod} pod is not running"

local pod_id="$(get_pods_regex $controller_pod $op_ns)"
local pod_id
pod_id="$(get_pods_regex '$controller_pod' '$op_ns')"
Copy link
Contributor

Choose a reason for hiding this comment

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

This one still needs to be treated (" vs. ')

Copy link
Contributor

Choose a reason for hiding this comment

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

(It should be the last thing, consider it acked once it is addressed - I'm on PTO already, not sure when I get to it)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ldoktor changes applied

@GabyCT GabyCT force-pushed the topic/fixoperatorscript branch from bd770b1 to abe9283 Compare July 2, 2024 15:35
This PR gives general improvements to the operator script that is
being used in tests. This PR includes changes like better variable
definition and the use of a variable that has been already defined.

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
Copy link
Contributor

@ldoktor ldoktor left a comment

Choose a reason for hiding this comment

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

Thanks, lgtm now :-) (I'm sorry for the delay, it's PTO time...)

@ldoktor
Copy link
Contributor

ldoktor commented Jul 17, 2024

@stevenhorsman @wainersm the license check failed, do you have any experience with that? (this change should not have affected that)

@stevenhorsman
Copy link
Member

@stevenhorsman @wainersm the license check failed, do you have any experience with that? (this change should not have affected that)

I think we can ignore it as no-one in development has access to the report to check the issue. There seems to have been some sort of org setting that has triggered this check running on all PRs as we have the same issue in the CAA repo.

@ldoktor
Copy link
Contributor

ldoktor commented Jul 17, 2024

Well based on https://app.fossa.com/projects/git%2Bgithub.com%2Fconfidential-containers%2Foperator/refs/branch/main/abe928347a0ff9c3ecbeafceb0c761cc33cd4af1/browse/licenses I'd say it complains about go.mongodb.org/mongo-driver dependency, but that one is not new. Anyway I don't have access to the full report and also think it should be merged.

@fitzthum
Copy link
Member

The license check has been failing for a while. Unfortunately it's really hard to get details on why. Nobody has an account with FOSSA, but sometimes you can stumble onto the issue on the FOSSA page. Last I checked it was actually complaining about Kata, but I'm not sure what is happening this time. I wouldn't let it block this PR.

@ldoktor
Copy link
Contributor

ldoktor commented Jul 17, 2024

Thanks for the confirmation, let me merge this awesome numbered PR :-)

@ldoktor ldoktor merged commit 23aeb68 into confidential-containers:main Jul 17, 2024
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants