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

Aronchick/finish aws spot #36

Merged
merged 215 commits into from
Dec 9, 2024
Merged

Aronchick/finish aws spot #36

merged 215 commits into from
Dec 9, 2024

Conversation

aronchick
Copy link
Contributor

@aronchick aronchick commented Dec 9, 2024

Summary by CodeRabbit

  • New Features

    • Introduced new mock implementations for various interfaces, enhancing testing capabilities.
    • Added methods to existing mocks for simulating AWS EC2 interactions.
    • Created mocks for SSH-related functionalities, including SSHClienter, SSHSessioner, and SSHConfiger.
  • Bug Fixes

    • Updated method signatures for consistency across mocks.
  • Chores

    • Removed obsolete mock files to streamline the codebase.

…ou show me the files that import or use CDK-related packages? Typically, these would be in:

1. AWS provider files
2. Any infrastructure-as-code related files
3. Files in internal/clouds/aws or pkg/providers/aws

I'll help systematically remove CDK dependencies and replace them with standard AWS SDK calls. Can you share those files so I can help you refactor them?
…e commit message:

```
fix: Improve SSH utils test suite mocking and error handling
```

This commit message captures the essence of the changes:
- Fixing test suite issues
- Improving mocking for SSH-related methods
- Enhancing error handling and test coverage

Would you like me to elaborate on the changes or help you commit these modifications?
This commit addresses several issues in the SSH utils test suite:

1. Added `.Maybe()` to mock expectations to make them more flexible
2. Added more precise mock setup for various methods
3. Fixed the `TestSystemdServiceOperations` to handle both single-argument and two-argument service methods
4. Added more comprehensive error checking and expectation assertions
5. Ensured that mock expectations are met for each test case

Key improvements:
- More robust mocking
- Better handling of method calls
- More precise error checking
- Flexibility in test setup

Recommended next steps:
- Run the tests to verify the changes
- Review the updated test cases for completeness
- Consider adding more edge case tests if needed
@aronchick aronchick merged commit c44e578 into main Dec 9, 2024
1 check passed
Copy link

coderabbitai bot commented Dec 9, 2024

Caution

Review failed

The pull request is closed.

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 golangci-lint (1.62.2)

level=warning msg="[linters_context] copyloopvar: this linter is disabled because the Go version (1.21) of your project is lower than Go 1.22"

Walkthrough

This pull request includes the removal of several mock implementations for various AWS and GCP interfaces, specifically targeting the AWSInfraProviderer, AWSProviderer, CDKStackProviderer, CloudFormationAPIer, ConfigInterfacer, and CloseableClient. Additionally, new mock implementations have been introduced for the SFTPClientCreator, SFTPClienter, SFTPFile, SSHClientCreator, SSHClienter, SSHConfiger, and SSHSessioner interfaces, enhancing the mocking framework for unit tests by providing comprehensive methods for simulating and verifying interactions with these interfaces.

Changes

File Path Change Summary
mocks/aws/mock_AWSInfraProviderer.go Removed MockAWSInfraProviderer type and its methods.
mocks/aws/mock_AWSProviderer.go Removed MockAWSProviderer type and its methods.
mocks/aws/mock_CDKStackProviderer.go Removed MockCDKStackProviderer type and its methods.
mocks/aws/mock_CloudFormationAPIer.go Removed MockCloudFormationAPIer type and its methods.
mocks/aws/mock_ConfigInterfacer.go Removed MockConfigInterfacer type and its methods.
mocks/gcp/mock_CloseableClient.go Removed MockCloseableClient type and its methods.
mocks/sshutils/mock_SFTPClientCreator.go Added MockSFTPClientCreator type and methods for simulating SFTP client creation.
mocks/sshutils/mock_SFTPClienter.go Added MockSFTPClienter type with methods for SFTP operations.
mocks/sshutils/mock_SFTPFile.go Added MockSFTPFile type with methods for file operations.
mocks/sshutils/mock_SSHClientCreator.go Added MockSSHClientCreator type with methods for creating SSH clients.
mocks/sshutils/mock_SSHClienter.go Added MockSSHClienter type with methods for SSH operations.
mocks/sshutils/mock_SSHConfiger.go Added MockSSHConfiger type with methods for SSH configuration.
mocks/sshutils/mock_SSHSessioner.go Added MockSSHSessioner type with methods for managing SSH sessions.
mocks/common/mock_ClusterDeployerer.go Updated import path for sshutils package.

Poem

🐰 In the land of code where rabbits play,
Mocks have come and gone today.
With new friends to help us test,
We hop along, we do our best!
So let’s celebrate with joy and cheer,
For every change brings us near! 🥕


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6325ce2 and 36a227b.

⛔ Files ignored due to path filters (111)
  • .coderabbit.yaml is excluded by none and included by none
  • .cspell/custom-dictionary.txt is excluded by none and included by none
  • .mockery.yaml is excluded by none and included by none
  • README.md is excluded by none and included by none
  • ai/sop/spot.md is excluded by none and included by none
  • cmd/beta/aws/create_deployment.go is excluded by none and included by none
  • cmd/beta/aws/create_deployment_test.go is excluded by none and included by none
  • cmd/beta/aws/destroy_deployment.go is excluded by none and included by none
  • cmd/beta/aws/list_deployment.go is excluded by none and included by none
  • cmd/beta/aws/root.go is excluded by none and included by none
  • cmd/beta/provision/provisioner.go is excluded by none and included by none
  • cmd/beta/provision/provisioner_test.go is excluded by none and included by none
  • cmd/beta/provision/root.go is excluded by none and included by none
  • cmd/beta/provision/types.go is excluded by none and included by none
  • cspell.config.yaml is excluded by none and included by none
  • delete-vpcs.sh is excluded by none and included by none
  • docs/aws/api.md is excluded by none and included by none
  • docs/aws/configuration.md is excluded by none and included by none
  • docs/aws/migration.md is excluded by none and included by none
  • go.mod is excluded by none and included by none
  • go.sum is excluded by !**/*.sum and included by none
  • internal/clouds/aws/aws_data.yaml is excluded by none and included by none
  • internal/clouds/aws/locations.go is excluded by none and included by none
  • internal/clouds/aws/locations_test.go is excluded by none and included by none
  • internal/clouds/general/105_install_run_bacalhau.sh is excluded by none and included by none
  • internal/clouds/general/bacalhau.service is excluded by none and included by none
  • internal/generate_cloud_data.go is excluded by none and included by none
  • internal/testdata/aws.go is excluded by none and included by none
  • internal/testdata/configs/aws.yaml is excluded by none and included by none
  • internal/testdata/embed.go is excluded by none and included by none
  • internal/testutil/ssh_utils.go is excluded by none and included by none
  • pkg/models/aws.go is excluded by none and included by none
  • pkg/models/deployment.go is excluded by none and included by none
  • pkg/models/interfaces/aws/aws_providerer.go is excluded by none and included by none
  • pkg/models/interfaces/aws/ec2_clienter.go is excluded by none and included by none
  • pkg/models/interfaces/aws/mocks/aws/mock_EC2Clienter.go is excluded by none and included by none
  • pkg/models/interfaces/aws/mocks/azure/mock_AzureClienter.go is excluded by none and included by none
  • pkg/models/interfaces/aws/mocks/azure/mock_Pollerer.go is excluded by none and included by none
  • pkg/models/interfaces/aws/mocks/common/mock_Clienter.go is excluded by none and included by none
  • pkg/models/interfaces/aws/mocks/common/mock_ClusterDeployerer.go is excluded by none and included by none
  • pkg/models/interfaces/aws/mocks/gcp/mock_GCPClienter.go is excluded by none and included by none
  • pkg/models/interfaces/aws/mocks/sshutils/mock_SFTPClientCreator.go is excluded by none and included by none
  • pkg/models/interfaces/aws/mocks/sshutils/mock_SFTPClienter.go is excluded by none and included by none
  • pkg/models/interfaces/aws/mocks/sshutils/mock_SFTPFile.go is excluded by none and included by none
  • pkg/models/interfaces/aws/mocks/sshutils/mock_SSHClientCreator.go is excluded by none and included by none
  • pkg/models/interfaces/aws/mocks/sshutils/mock_SSHClienter.go is excluded by none and included by none
  • pkg/models/interfaces/aws/mocks/sshutils/mock_SSHConfiger.go is excluded by none and included by none
  • pkg/models/interfaces/aws/mocks/sshutils/mock_SSHSessioner.go is excluded by none and included by none
  • pkg/models/interfaces/common/cluster_deployerer.go is excluded by none and included by none
  • pkg/models/interfaces/sshutils/mocks/aws/mock_EC2Clienter.go is excluded by none and included by none
  • pkg/models/interfaces/sshutils/mocks/azure/mock_AzureClienter.go is excluded by none and included by none
  • pkg/models/interfaces/sshutils/mocks/azure/mock_Pollerer.go is excluded by none and included by none
  • pkg/models/interfaces/sshutils/mocks/common/mock_Clienter.go is excluded by none and included by none
  • pkg/models/interfaces/sshutils/mocks/common/mock_ClusterDeployerer.go is excluded by none and included by none
  • pkg/models/interfaces/sshutils/mocks/gcp/mock_GCPClienter.go is excluded by none and included by none
  • pkg/models/interfaces/sshutils/mocks/sshutils/mock_SFTPClientCreator.go is excluded by none and included by none
  • pkg/models/interfaces/sshutils/mocks/sshutils/mock_SFTPClienter.go is excluded by none and included by none
  • pkg/models/interfaces/sshutils/mocks/sshutils/mock_SFTPFile.go is excluded by none and included by none
  • pkg/models/interfaces/sshutils/mocks/sshutils/mock_SSHClientCreator.go is excluded by none and included by none
  • pkg/models/interfaces/sshutils/mocks/sshutils/mock_SSHClienter.go is excluded by none and included by none
  • pkg/models/interfaces/sshutils/mocks/sshutils/mock_SSHConfiger.go is excluded by none and included by none
  • pkg/models/interfaces/sshutils/mocks/sshutils/mock_SSHSessioner.go is excluded by none and included by none
  • pkg/models/interfaces/sshutils/session.go is excluded by none and included by none
  • pkg/models/interfaces/sshutils/sftp.go is excluded by none and included by none
  • pkg/models/interfaces/sshutils/ssh_client.go is excluded by none and included by none
  • pkg/models/interfaces/sshutils/ssh_interfaces.go is excluded by none and included by none
  • pkg/models/machine.go is excluded by none and included by none
  • pkg/providers/aws/aws_compute_operations.go is excluded by none and included by none
  • pkg/providers/aws/cdk_bootstrapper.go is excluded by none and included by none
  • pkg/providers/aws/deploy_spot.go is excluded by none and included by none
  • pkg/providers/aws/destroy.go is excluded by none and included by none
  • pkg/providers/aws/destroy_test.go is excluded by none and included by none
  • pkg/providers/aws/diagnostics.go is excluded by none and included by none
  • pkg/providers/aws/ec2.go is excluded by none and included by none
  • pkg/providers/aws/ec2_test.go is excluded by none and included by none
  • pkg/providers/aws/integration_test.go is excluded by none and included by none
  • pkg/providers/aws/interfaces/ec2_clienter.go is excluded by none and included by none
  • pkg/providers/aws/performance_test.go is excluded by none and included by none
  • pkg/providers/aws/provider.go is excluded by none and included by none
  • pkg/providers/aws/provider_test.go is excluded by none and included by none
  • pkg/providers/aws/spot_instances.go is excluded by none and included by none
  • pkg/providers/aws/types.go is excluded by none and included by none
  • pkg/providers/aws/utils.go is excluded by none and included by none
  • pkg/providers/azure/client_mock.go is excluded by none and included by none
  • pkg/providers/azure/create_resource_test.go is excluded by none and included by none
  • pkg/providers/azure/deploy_bacalhau_test.go is excluded by none and included by none
  • pkg/providers/azure/integration_test.go is excluded by none and included by none
  • pkg/providers/azure/provider.go is excluded by none and included by none
  • pkg/providers/common/cluster_deployer.go is excluded by none and included by none
  • pkg/providers/common/cluster_deployer_test.go is excluded by none and included by none
  • pkg/providers/common/deployment.go is excluded by none and included by none
  • pkg/providers/common/machine_config.go is excluded by none and included by none
  • pkg/providers/gcp/client_compute.go is excluded by none and included by none
  • pkg/providers/gcp/integration_test.go is excluded by none and included by none
  • pkg/providers/gcp/provider.go is excluded by none and included by none
  • pkg/sshutils/constants.go is excluded by none and included by none
  • pkg/sshutils/mock_helpers.go is excluded by none and included by none
  • pkg/sshutils/mock_sshutils.go is excluded by none and included by none
  • pkg/sshutils/sftp.go is excluded by none and included by none
  • pkg/sshutils/ssh_client.go is excluded by none and included by none
  • pkg/sshutils/ssh_config.go is excluded by none and included by none
  • pkg/sshutils/ssh_config_mock.go is excluded by none and included by none
  • pkg/sshutils/ssh_config_test.go is excluded by none and included by none
  • pkg/sshutils/ssh_dial.go is excluded by none and included by none
  • pkg/sshutils/ssh_session.go is excluded by none and included by none
  • pkg/sshutils/ssh_session_wrapper.go is excluded by none and included by none
  • pkg/sshutils/sshutils_test.go is excluded by none and included by none
  • pkg/testutil/testutil.go is excluded by none and included by none
  • pyproject.toml is excluded by none and included by none
  • requirements.txt is excluded by none and included by none
  • test/integration/create_deployment_test.go is excluded by none and included by none
📒 Files selected for processing (15)
  • mocks/aws/mock_AWSInfraProviderer.go (0 hunks)
  • mocks/aws/mock_AWSProviderer.go (0 hunks)
  • mocks/aws/mock_CDKStackProviderer.go (0 hunks)
  • mocks/aws/mock_CloudFormationAPIer.go (0 hunks)
  • mocks/aws/mock_ConfigInterfacer.go (0 hunks)
  • mocks/aws/mock_EC2Clienter.go (12 hunks)
  • mocks/common/mock_ClusterDeployerer.go (1 hunks)
  • mocks/gcp/mock_CloseableClient.go (0 hunks)
  • mocks/sshutils/mock_SFTPClientCreator.go (1 hunks)
  • mocks/sshutils/mock_SFTPClienter.go (1 hunks)
  • mocks/sshutils/mock_SFTPFile.go (1 hunks)
  • mocks/sshutils/mock_SSHClientCreator.go (1 hunks)
  • mocks/sshutils/mock_SSHClienter.go (1 hunks)
  • mocks/sshutils/mock_SSHConfiger.go (1 hunks)
  • mocks/sshutils/mock_SSHSessioner.go (1 hunks)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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.

1 participant