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

Add Turbinia e2e GKE test #1400

Merged
merged 5 commits into from
Nov 30, 2023
Merged

Add Turbinia e2e GKE test #1400

merged 5 commits into from
Nov 30, 2023

Conversation

wajihyassine
Copy link
Member

@wajihyassine wajihyassine commented Nov 22, 2023

Description of the change

Updates Turbinia GCP/GKE e2e testing using new Turbinia client and API server instead.

Checklist

  • All tests were successful.

@wajihyassine wajihyassine self-assigned this Nov 22, 2023
@wajihyassine wajihyassine marked this pull request as ready for review November 22, 2023 22:02
Copy link
Collaborator

@hacktobeer hacktobeer left a comment

Choose a reason for hiding this comment

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

Good to see we are moving the e2e tests to GKE as well! PTAL.

turbinia/e2e/run-e2e-gke.sh Show resolved Hide resolved
# The e2e test will test Turbinia googleclouddisk processing
# Requirements:
# - have 'kubectl', 'jq' packages installed
# - have the Turbinia Helm chart deployed and are authenticated to the GKE cluster
Copy link
Collaborator

Choose a reason for hiding this comment

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

add command needed to authenticate? or maybe even do this in the script as you already need zone/projectname anyway.

gcloud container clusters get-credentials [clustername] --zone [zone] --project [project_name]

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack I added it to the requirements for now

turbinia/e2e/run-e2e-gke.sh Show resolved Hide resolved
echo -n "Started at "
date -Iseconds

# Back up existing Turbinia config else script will attempt to connect to wrong Turbinia instance
Copy link
Collaborator

Choose a reason for hiding this comment

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

Both backing up and replacing config? Would be nice to restore this at the end of the script.

  • put functionality in bash functions in script (backup, replace, restore)
  • call them to backup/replace and at the end to restore original configuration.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack added a way to restore the backup at the end. holding off on moving things into functions because then I'll want to move everything into functions which could be a nice cleanup but something we can do in like a V2

Copy link
Member

Choose a reason for hiding this comment

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

Or we could leave this copy alone and then write the new copy to a different directory (e.g. something like ~/.turbinia-e2e-test/`) and point to it with the command line flag.

Copy link
Collaborator

Choose a reason for hiding this comment

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

actually like Aarons suggestion. that is much cleaner.

fi

# Replace Turbinia config with test config
echo "Writing turbinia config to $HOME/.turbinia_api_config.json..."
Copy link
Collaborator

Choose a reason for hiding this comment

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

You use $HOME here and ~/ above, I would use one or the other.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack good catch updated it to just use ~

turbinia/e2e/run-e2e-gke.sh Show resolved Hide resolved
echo "Running Turbinia: turbinia-client submit googleclouddisk --project $GCP_PROJECT --zone $GCP_ZONE --disk_name $DISK --request_id $REQUEST_ID"
turbinia-client submit googleclouddisk --project $GCP_PROJECT --zone $GCP_ZONE --disk_name $DISK --request_id $REQUEST_ID
# Give time for Tasks to populate
sleep 5
Copy link
Collaborator

Choose a reason for hiding this comment

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

You are waiting here until the request has reached status 'running' I think. Why not use the same method as below to check that the request is in running. Once it is you can continue.

Copy link
Member Author

Choose a reason for hiding this comment

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

I updated the while statement slightly to evaluate on while $req_status = "running".

The other reason I did this is because the time you submit the request has lag time to when its actually reached the server and is stored in redis so I'm sleeping here to wait a little, maybe a better way to do this so open to ideas. I think if we had polling implemented directly then this wouldn't be much of an issue

done

# Grab all Tasks where successful = false
echo "Checking the status of Turbinia request: $REQUEST_ID"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we need a feature request to have the turbinia client be able to filter status requests on eg failed tasks ( or other relevant status filters).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah that would be neat for filtering through the request and can use it for Web UI as well so you don't have to subtract and filter like this. Lmk if you want to file a bug else I can tmrw

# Check if there is a failed Turbinia Task
if [[ $length > 0 ]]
then
echo "A failed Task for Turbinia Request $req has been detected."
Copy link
Collaborator

Choose a reason for hiding this comment

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

some indentation issues in below 'if' and further 'for/do' loops

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah weird it didnt show in my vscode but updated to fix the formatting

turbinia/e2e/run-e2e-gke.sh Show resolved Hide resolved
Copy link
Member Author

@wajihyassine wajihyassine left a comment

Choose a reason for hiding this comment

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

Thank you @hacktobeer for the thorough look! Everything should be addressed and ready for another pass

# The e2e test will test Turbinia googleclouddisk processing
# Requirements:
# - have 'kubectl', 'jq' packages installed
# - have the Turbinia Helm chart deployed and are authenticated to the GKE cluster
Copy link
Member Author

Choose a reason for hiding this comment

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

Ack I added it to the requirements for now

turbinia/e2e/run-e2e-gke.sh Show resolved Hide resolved
echo -n "Started at "
date -Iseconds

# Back up existing Turbinia config else script will attempt to connect to wrong Turbinia instance
Copy link
Member Author

Choose a reason for hiding this comment

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

Ack added a way to restore the backup at the end. holding off on moving things into functions because then I'll want to move everything into functions which could be a nice cleanup but something we can do in like a V2

fi

# Replace Turbinia config with test config
echo "Writing turbinia config to $HOME/.turbinia_api_config.json..."
Copy link
Member Author

Choose a reason for hiding this comment

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

Ack good catch updated it to just use ~

turbinia/e2e/run-e2e-gke.sh Show resolved Hide resolved
turbinia/e2e/run-e2e-gke.sh Show resolved Hide resolved
echo "Running Turbinia: turbinia-client submit googleclouddisk --project $GCP_PROJECT --zone $GCP_ZONE --disk_name $DISK --request_id $REQUEST_ID"
turbinia-client submit googleclouddisk --project $GCP_PROJECT --zone $GCP_ZONE --disk_name $DISK --request_id $REQUEST_ID
# Give time for Tasks to populate
sleep 5
Copy link
Member Author

Choose a reason for hiding this comment

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

I updated the while statement slightly to evaluate on while $req_status = "running".

The other reason I did this is because the time you submit the request has lag time to when its actually reached the server and is stored in redis so I'm sleeping here to wait a little, maybe a better way to do this so open to ideas. I think if we had polling implemented directly then this wouldn't be much of an issue

# Check if there is a failed Turbinia Task
if [[ $length > 0 ]]
then
echo "A failed Task for Turbinia Request $req has been detected."
Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah weird it didnt show in my vscode but updated to fix the formatting

turbinia/e2e/run-e2e-gke.sh Show resolved Hide resolved
done

# Grab all Tasks where successful = false
echo "Checking the status of Turbinia request: $REQUEST_ID"
Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah that would be neat for filtering through the request and can use it for Web UI as well so you don't have to subtract and filter like this. Lmk if you want to file a bug else I can tmrw

Copy link
Member

@aarontp aarontp left a comment

Choose a reason for hiding this comment

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

From a high level and cursory look it LGTM and since @hacktobeer has already reviewed I think we should be set from the review standpoint. Thanks!

echo -n "Started at "
date -Iseconds

# Back up existing Turbinia config else script will attempt to connect to wrong Turbinia instance
Copy link
Member

Choose a reason for hiding this comment

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

Or we could leave this copy alone and then write the new copy to a different directory (e.g. something like ~/.turbinia-e2e-test/`) and point to it with the command line flag.

Copy link
Collaborator

@hacktobeer hacktobeer left a comment

Choose a reason for hiding this comment

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

Have a look at comment Aaron. Makes sense to use a different location for the config file and use it with the client CLI switch.
For the rest -> Approved.

@wajihyassine
Copy link
Member Author

Awesome thank you for the review @hacktobeer and @aarontp!

Talking to Aaron out of band, it looks like the -c param is broken and will file a bug separately and leaving the config logic is fine as is for now given will just be used for the automated e2e tests but can be updated in a V2 iteration later

@wajihyassine wajihyassine merged commit 5881b67 into master Nov 30, 2023
jleaniz pushed a commit to jleaniz/turbinia that referenced this pull request Feb 28, 2024
* Add Turbinia e2e GKE test

* rename e2e script

* list turbinia config sleep on port-forward

* fix spelling

* Address review comments
jleaniz pushed a commit to jleaniz/turbinia that referenced this pull request Mar 18, 2024
* Add Turbinia e2e GKE test

* rename e2e script

* list turbinia config sleep on port-forward

* fix spelling

* Address review comments
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.

3 participants