Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

# Single source of truth for tool versions
env:
GO_VERSION: '1.24.12'
GO_VERSION: '1.24.13'
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:

# Single source of truth for tool versions
env:
GO_VERSION: '1.24.12'
GO_VERSION: '1.24.13'
GOLANGCI_LINT_VERSION: 'v2.5.0'

jobs:
Expand Down
2 changes: 1 addition & 1 deletion ci/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ image_resource:
type: registry-image
source:
repository: golang
tag: 1.24.12-bookworm
tag: 1.24.13-bookworm
registry_mirror:
host: ((ecr_repository_uri))
aws_access_key_id: ((aws_access_key_id))
Expand Down
17 changes: 13 additions & 4 deletions mapper/dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,21 @@ func MapDatasetLandingPageToDatasetAPI(ctx context.Context, datasetID string, pa
existingTopicIDs = append(existingTopicIDs, pageData.Description.CanonicalTopic)
}

topicIDs := cache.ExtractTopicIDsFromURI(ctx, pageData.URI, existingTopicIDs, topicCache)

// Only validate topics if not using mock cache
// When mock cache is enabled, we skip topic validation as the cache is non-functional
if !topicCache.IsMockCache(ctx) && len(topicIDs) == 0 {
return nil, errors.New("no topics found for dataset - datasets must have at least one topic")
var topicIDs []string
if !topicCache.IsMockCache(ctx) {
topicIDs = cache.ExtractTopicIDsFromURI(ctx, pageData.URI, existingTopicIDs, topicCache)
if len(topicIDs) == 0 {
return nil, errors.New("no topics found for dataset - datasets must have at least one topic")
}
} else {
// When mock cache is disabled, add the mock-topic topic ID
topic, err := topicCache.GetTopic(ctx, "mock-topic")
if err != nil {
return nil, errors.New("mock topic not found in topic cache - if topic cache is disabled, mock topic should exist")
}
topicIDs = []string{topic.ID}
}

// If NextRelease has no value, set to "To be announced".
Expand Down
5 changes: 3 additions & 2 deletions mapper/dataset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,9 @@ func TestMapDatasetLandingPageToDatasetAPI(t *testing.T) {
So(dataset, ShouldNotBeNil)
})

Convey("And the dataset has an empty topics list", func() {
So(len(dataset.Topics), ShouldEqual, 0)
Convey("And the dataset has the mock topic ID in its topics list", func() {
So(len(dataset.Topics), ShouldEqual, 1)
So(dataset.Topics[0], ShouldEqual, "0000")
})
})
})
Expand Down