Skip to content

Commit

Permalink
Merge pull request #26 from codecrafters-io/alpha-fixes-4
Browse files Browse the repository at this point in the history
Alpha fixes - 4
  • Loading branch information
ryan-gang authored Oct 1, 2024
2 parents fce4f5a + 3cf4669 commit 9db82cc
Show file tree
Hide file tree
Showing 16 changed files with 402 additions and 531 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: 1.22.x

Expand Down
11 changes: 8 additions & 3 deletions internal/assertions/apiversions_response_assertion.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,18 @@ func (a ApiVersionsResponseAssertion) Evaluate(fields []string, AssertApiVersion
for _, actualApiVersionKey := range a.ActualValue.ApiKeys {
if actualApiVersionKey.ApiKey == expectedApiVersionKey.ApiKey {
found = true
if actualApiVersionKey.MinVersion > expectedApiVersionKey.MinVersion {
if actualApiVersionKey.MaxVersion < expectedApiVersionKey.MinVersion {
return fmt.Errorf("Expected max version %v to be >= min version %v for %s", actualApiVersionKey.MaxVersion, actualApiVersionKey.MinVersion, apiKeyNames[expectedApiVersionKey.ApiKey])
}

// anything above or equal to expected minVersion is fine
if actualApiVersionKey.MinVersion < expectedApiVersionKey.MinVersion {
return fmt.Errorf("Expected API version %v to be supported for %s, got %v", expectedApiVersionKey.MaxVersion, apiKeyNames[expectedApiVersionKey.ApiKey], actualApiVersionKey.MaxVersion)
}
logger.Successf("✓ API version %v is supported for %s", actualApiVersionKey.MaxVersion, apiKeyNames[expectedApiVersionKey.ApiKey])

if actualApiVersionKey.MinVersion < expectedApiVersionKey.MinVersion {
return fmt.Errorf("Expected API version %v to be supported for %s, got %v", expectedApiVersionKey.MinVersion, apiKeyNames[expectedApiVersionKey.ApiKey], actualApiVersionKey.MinVersion)
if actualApiVersionKey.MaxVersion < expectedApiVersionKey.MaxVersion {
return fmt.Errorf("Expected API version %v to be supported for %s, got %v", expectedApiVersionKey.MaxVersion, apiKeyNames[expectedApiVersionKey.ApiKey], actualApiVersionKey.MaxVersion)
}
logger.Successf("✓ API version %v is supported for %s", actualApiVersionKey.MinVersion, apiKeyNames[expectedApiVersionKey.ApiKey])
}
Expand Down
Loading

0 comments on commit 9db82cc

Please sign in to comment.