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

Addressing TODOs for NodeGetVolumeMetrics and NodeUnstageVolume #3985

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

mye956
Copy link
Contributor

@mye956 mye956 commented Oct 25, 2023

Summary

This PR will address all of the leftover TODOs for NodeGetVolumeMetrics and NodeUnstageVolume functionality for EBS-backed tasks.

Implementation details

  • agent/engine/task_manager.go: Changed UnstageVolumes to return a list of any errors that were encountered when trying to unstage a volume via the CSI driver. We'll then log all encountered errors. This will be helpful for having unit tests since otherwise we wouldn't know whether or not there were any issues.
  • agent/taskresource: Added new getters within the Volume interface. This is to avoid typecasting the volume within the NodeGetVolumeMetrics as mentioned in #3929.
  • agent/stats/engine_unix.go: No longer type casting the task volume within fetchEBSVolumeMetrics in order to obtain the EBS volume and will instead use the getters implemented in agent/taskresource

Related PR: #3929

Testing

New unit tests:

  • TestFetchEBSVolumeMetricsHappy
  • TestFetchEBSVolumeMetricsUnhappy
  • TestFetchEBSVolumeMetricsNoTimeoutError
  • TestFetchEBSVolumeMetricsTimeoutError
  • TestUnstageVolumesHappy
  • TestUnstageVolumesUnhappy
  • TestUnstageVolumesNoTimeoutError
  • TestUnstageVolumesTimeoutError

New tests cover the changes: Yes

Description for the changelog

Added more unit testing for NodeUnstageVolume and NodeGetVolumeMetrics as well as address other leftover TODOs for EBS-backed task

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@mye956 mye956 force-pushed the ebsTodos branch 2 times, most recently from c6db056 to f1bea74 Compare October 25, 2023 18:27
@mye956 mye956 marked this pull request as ready for review October 25, 2023 18:38
@mye956 mye956 requested a review from a team as a code owner October 25, 2023 18:38
@mye956 mye956 changed the title [WIP] Addressing TODOs for NodeGetVolumeMetrics and NodeUnstageVolume Addressing TODOs for NodeGetVolumeMetrics and NodeUnstageVolume Oct 25, 2023
agent/engine/task_manager_test.go Outdated Show resolved Hide resolved
agent/engine/task_manager_test.go Outdated Show resolved Hide resolved
agent/engine/task_manager_test.go Outdated Show resolved Hide resolved
agent/stats/engine_unix_test.go Outdated Show resolved Hide resolved
agent/stats/engine_unix_test.go Outdated Show resolved Hide resolved
agent/stats/engine_unix_test.go Outdated Show resolved Hide resolved
agent/stats/engine_unix_test.go Outdated Show resolved Hide resolved
@@ -2227,3 +2231,157 @@ func TestTaskWaitForHostResources(t *testing.T) {
topTask, err = taskEngine.topTask()
assert.Error(t, err)
}

func TestUnstageVolumesHappy(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

in future we can reference the "happy" case as just Test and "sad" cases can be named Test + some designation specific to their failure mode. (I see that you do this below: TestUnstageVolumesNoTimeoutError)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, it might be more helpful using a table as well for testing as @amogh09 suggested!

agent/stats/engine_unix_test.go Outdated Show resolved Hide resolved
@mye956 mye956 force-pushed the ebsTodos branch 2 times, most recently from f25ee53 to b0f2a3d Compare October 25, 2023 21:25
amogh09
amogh09 previously approved these changes Oct 25, 2023
}

func (cfg *EFSVolumeConfig) GetVolumeId() string {
return ""
Copy link
Member

Choose a reason for hiding this comment

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

I worry about adding something like this when there's an existing ID for EFS which we might want to return

"fileSystemId": "fs-1234"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. I recall this was sort of the reason why I originally opted to type-cast since not all volumes types will have fields like volume ID, device name, etc.

}

func (cfg *DockerVolumeConfig) GetVolumeId() string {
return ""
Copy link
Member

Choose a reason for hiding this comment

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

ditto here -- is there a unique identifier we should return for a docker volume besides its name (which I believe is unique per host)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

^ same response as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I assume the docker volume name?

@mye956 mye956 merged commit 610a2b7 into aws:dev Oct 27, 2023
7 checks passed
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.

4 participants