Skip to content

Ruby SR/MR cluster management#142

Merged
mitchell-elholm merged 6 commits intomainfrom
Ruby_CM_Update
May 16, 2025
Merged

Ruby SR/MR cluster management#142
mitchell-elholm merged 6 commits intomainfrom
Ruby_CM_Update

Conversation

@mitchell-elholm
Copy link
Copy Markdown
Contributor

@mitchell-elholm mitchell-elholm commented May 16, 2025

  • Update Ruby CM example to match API changes
  • Updated README to match other samples
  • Does not have code to clean up orphaned clusters

By submitting this pull request, I confirm that my contribution is made under
the terms of the MIT-0 license.

Thank you for your contribution!

@mitchell-elholm mitchell-elholm marked this pull request as ready for review May 16, 2025 01:31
Comment thread ruby/cluster_management/Gemfile Outdated
source "https://rubygems.org"

gem "aws-sdk-dsql", "~> 1"
gem "aws-sdk-dsql", "1.8.0"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can use "~> 1.8" to keep pulling in versions [1.8 .. 2)

Comment thread ruby/cluster_management/Gemfile Outdated

gem 'rspec', '3.13.0'
gem 'aws-sdk-core', '3.211.0' No newline at end of file
gem 'aws-sdk-core', '~> 3' No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this required? pretty sure I was able to run locally without it.

Comment thread ruby/cluster_management/README.md Outdated
Comment on lines +11 to +25
* Ruby version >=3.3 is needed
- Ruby version >= 2.5 is installed.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ah, 2.5 matches CI but that version has been EOL since 2021. Can you bump CI to 3.3?

export REGION_2="us-east-2"
export WITNESS_REGION="us-west-2"

bundle install
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

not blocking, comment on existing behavior: This can be painful if it targets system ruby (MacOS). It's not guaranteed to fail but we can suggest folks set up rbenv before running. We do this in rails instructions.

cluster_1, cluster_2 = create_multi_region_clusters(region_1, region_2, witness_region)
cluster_id_1 = cluster_1["identifier"]
cluster_id_2 = cluster_2["identifier"]
raise "Cluster_1 identifier should not be null" if cluster_id_1.nil?
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Consider this:

it "goes through a full life cycle" do
  cluster_1, cluster_2 = create_multi_region_clusters(...)
  expect { cluster_1["status"] }.to eq "ACTIVE"

  # and so on: update -> get -> delete
end

The idea is you hoist all your operations outside the expect block and transform your raise into expect

delete_cluster(region_1, cluster_id)

}.not_to raise_error
end
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Optional: you could add a cluster sweeper (java ex) to an after(:context) block [rspec docs].

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Might be wasted effort if it's not already implemented in Ruby - I should have a shared version up for PR tomorrow which can be reused here

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

it's already written, just need to wire it up in a test :D

I am excited to see this reusable version 🥁

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is in draft as #144

Copy link
Copy Markdown
Collaborator

@trstephen-amazon trstephen-amazon left a comment

Choose a reason for hiding this comment

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

A couple optional enhancements. 🚢

```bash
# Optional use rbenv
rbenv install 3.3.5
rbenv local 3.3.5
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

FYI: you can set a .rbenv file in the root directory with contents

3.3.5

to set automatically.

Comment on lines +12 to +13
describe 'perform multi-region smoke tests' do
it 'does not raise any exception' do
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: describes old test behavior

Copy link
Copy Markdown
Contributor

@danielfrankcom danielfrankcom left a comment

Choose a reason for hiding this comment

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

Only small thing is we should align the environment variable names with the other examples as discussed offline for consistency.

@mitchell-elholm mitchell-elholm merged commit 3a77c01 into main May 16, 2025
3 of 4 checks passed
@mitchell-elholm mitchell-elholm deleted the Ruby_CM_Update branch May 16, 2025 21:59
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