diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index cfdf2e1..5a97a31 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -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: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76f7236..7fffcf2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/ci/build.yml b/ci/build.yml index cb4ec3b..7cca4ec 100644 --- a/ci/build.yml +++ b/ci/build.yml @@ -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)) diff --git a/mapper/dataset.go b/mapper/dataset.go index 7d96e20..5a8220a 100644 --- a/mapper/dataset.go +++ b/mapper/dataset.go @@ -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". diff --git a/mapper/dataset_test.go b/mapper/dataset_test.go index 8086e20..6326788 100644 --- a/mapper/dataset_test.go +++ b/mapper/dataset_test.go @@ -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") }) }) })