-
Notifications
You must be signed in to change notification settings - Fork 167
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
Conversation
There was a problem hiding this 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
Outdated
# 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 |
There was a problem hiding this comment.
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]
There was a problem hiding this comment.
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
echo -n "Started at " | ||
date -Iseconds | ||
|
||
# Back up existing Turbinia config else script will attempt to connect to wrong Turbinia instance |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
turbinia/e2e/run-e2e-gke.sh
Outdated
fi | ||
|
||
# Replace Turbinia config with test config | ||
echo "Writing turbinia config to $HOME/.turbinia_api_config.json..." |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Outdated
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
turbinia/e2e/run-e2e-gke.sh
Outdated
done | ||
|
||
# Grab all Tasks where successful = false | ||
echo "Checking the status of Turbinia request: $REQUEST_ID" |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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
turbinia/e2e/run-e2e-gke.sh
Outdated
# Check if there is a failed Turbinia Task | ||
if [[ $length > 0 ]] | ||
then | ||
echo "A failed Task for Turbinia Request $req has been detected." |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this 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
turbinia/e2e/run-e2e-gke.sh
Outdated
# 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 |
There was a problem hiding this comment.
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
echo -n "Started at " | ||
date -Iseconds | ||
|
||
# Back up existing Turbinia config else script will attempt to connect to wrong Turbinia instance |
There was a problem hiding this comment.
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
turbinia/e2e/run-e2e-gke.sh
Outdated
fi | ||
|
||
# Replace Turbinia config with test config | ||
echo "Writing turbinia config to $HOME/.turbinia_api_config.json..." |
There was a problem hiding this comment.
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
Outdated
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 |
There was a problem hiding this comment.
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
turbinia/e2e/run-e2e-gke.sh
Outdated
# Check if there is a failed Turbinia Task | ||
if [[ $length > 0 ]] | ||
then | ||
echo "A failed Task for Turbinia Request $req has been detected." |
There was a problem hiding this comment.
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
Outdated
done | ||
|
||
# Grab all Tasks where successful = false | ||
echo "Checking the status of Turbinia request: $REQUEST_ID" |
There was a problem hiding this comment.
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
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
Awesome thank you for the review @hacktobeer and @aarontp! Talking to Aaron out of band, it looks like the |
* Add Turbinia e2e GKE test * rename e2e script * list turbinia config sleep on port-forward * fix spelling * Address review comments
* Add Turbinia e2e GKE test * rename e2e script * list turbinia config sleep on port-forward * fix spelling * Address review comments
Description of the change
Updates Turbinia GCP/GKE e2e testing using new Turbinia client and API server instead.
Checklist