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 back the Docker::Version.correct? method #8030

Merged
merged 2 commits into from
Sep 13, 2023
Merged

Conversation

Nishnha
Copy link
Member

@Nishnha Nishnha commented Sep 13, 2023

The #correct? method mimics creating a new Docker::Version without actually instantiating one. It checks that the semver part of the Docker::Version is actually valid semver.

The previous version of this method called #new and Docker::Version#new would call Gem::Version#new which would call #correct?, and it would get stuck in an infinite loop, so it was removed.

This PR adds in a working version of the method and there are already existing test cases for it like

describe ".correct?" do
def check_version_for_correctness?(version)
docker_version = described_class.new(version)
described_class.correct?(docker_version)
end
it "classifies standard versions as correct" do
expect(check_version_for_correctness?("2.4.2")).to be true
end
it "classifies java versions as correct" do
expect(check_version_for_correctness?("11.0.16_8")).to be true
expect(check_version_for_correctness?("v11.0.16_8")).to be true
expect(check_version_for_correctness?("11.0.16.1")).to be true
end
end

@Nishnha Nishnha requested a review from a team as a code owner September 13, 2023 22:42
@github-actions github-actions bot added the L: docker Docker containers label Sep 13, 2023
@Nishnha Nishnha merged commit c7f0373 into main Sep 13, 2023
80 checks passed
@Nishnha Nishnha deleted the nishnha/fix-docker-correct branch September 13, 2023 23:48
brettfo pushed a commit to brettfo/dependabot-core that referenced this pull request Oct 11, 2023
…-correct

Add back the Docker::Version.correct? method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: docker Docker containers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants