Skip to content

Commit

Permalink
Update load of search param status on initialization (#4711)
Browse files Browse the repository at this point in the history
Update initialization of search param status

Refs AB#131939
  • Loading branch information
feordin authored Nov 6, 2024
1 parent 323b9e8 commit 6525a6d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 8 deletions.
14 changes: 8 additions & 6 deletions build/jobs/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ steps:
Path: '$(Build.SourcesDirectory)'
ToolVersion: Latest

- task: Trivy@1
displayName: 'Run Trivy'
inputs:
Target: '$(Build.SourcesDirectory)/build/docker'
Severities: all
VulTypes: all
## Currently removed due to too many requests issue: https://github.com/aquasecurity/trivy-action/issues/430
## User story to address restoring this: 132160
#- task: Trivy@1
# displayName: 'Run Trivy'
# inputs:
# Target: '$(Build.SourcesDirectory)/build/docker'
# Severities: all
# VulTypes: all

- task: PSScriptAnalyzer@1
displayName: 'Run PSScriptAnalyzer'
Expand Down
1 change: 1 addition & 0 deletions build/jobs/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
docker pull mirror.gcr.io/moby/buildkit:buildx-stable-1
TAG="$(azureContainerRegistry)/${{parameters.version}}_fhir-server:${{parameters.tag}}"
az acr login --name $(azureContainerRegistryName)
docker buildx create --name fhir-multi-platform --platform ${{parameters.buildPlatform}} --use --bootstrap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class SearchParameterStatusManagerTests
private static readonly string ResourceProfile = "http://hl7.org/fhir/SearchParameter/Resource-profile";
private static readonly string ResourceSecurity = "http://hl7.org/fhir/SearchParameter/Resource-security";
private static readonly string ResourceQuery = "http://hl7.org/fhir/SearchParameter/Resource-query";
private static readonly string ResourceSource = "http://hl7.org/fhir/SearchParameter/Resource-source";

private readonly SearchParameterStatusManager _manager;
private readonly ISearchParameterStatusDataStore _searchParameterStatusDataStore;
Expand Down Expand Up @@ -85,6 +86,12 @@ public SearchParameterStatusManagerTests()
Uri = new Uri(ResourceSecurity),
LastUpdated = Clock.UtcNow,
},
new ResourceSearchParameterStatus
{
Status = SearchParameterStatus.Disabled,
Uri = new Uri(ResourceSource),
LastUpdated = Clock.UtcNow,
},
};

_searchParameterStatusDataStore.GetSearchParameterStatuses(Arg.Any<CancellationToken>()).Returns(_resourceSearchParameterStatuses);
Expand All @@ -99,6 +106,7 @@ public SearchParameterStatusManagerTests()
new SearchParameterInfo("_profile", "_profile", SearchParamType.Token, new Uri(ResourceProfile), targetResourceTypes: targetResourceTypes),
new SearchParameterInfo("_security", "_security", SearchParamType.Token, new Uri(ResourceSecurity), targetResourceTypes: targetResourceTypes),
_queryParameter,
new SearchParameterInfo("_source", "_source", SearchParamType.Uri, new Uri(ResourceSource), targetResourceTypes: targetResourceTypes),
};

_searchParameterDefinitionManager.GetSearchParameters("Account")
Expand All @@ -117,6 +125,10 @@ public SearchParameterStatusManagerTests()
_searchParameterSupportResolver
.IsSearchParameterSupported(Arg.Is(_searchParameterInfos[4]))
.Returns((true, false));

_searchParameterSupportResolver
.IsSearchParameterSupported(Arg.Is(_searchParameterInfos[5]))
.Returns((true, false));
}

[Fact]
Expand Down Expand Up @@ -145,6 +157,11 @@ public async Task GivenASPStatusManager_WhenInitializing_ThenSearchParameterIsUp
Assert.False(list[4].IsSearchable);
Assert.True(list[4].IsSupported);
Assert.False(list[4].IsPartiallySupported);

Assert.False(list[5].IsSearchable);
Assert.False(list[5].IsSupported); // Disabled Search Params show as unsupported
Assert.False(list[5].IsPartiallySupported);
Assert.Equal(SearchParameterStatus.Disabled, list[5].SearchParameterStatus);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,14 @@ internal async Task EnsureInitializedAsync(CancellationToken cancellationToken)
if (p.IsSearchable != tempStatus.IsSearchable ||
p.IsSupported != tempStatus.IsSupported ||
p.IsPartiallySupported != tempStatus.IsPartiallySupported ||
p.SortStatus != result.SortStatus)
p.SortStatus != result.SortStatus ||
p.SearchParameterStatus != result.Status)
{
p.IsSearchable = tempStatus.IsSearchable;
p.IsSupported = tempStatus.IsSupported;
p.IsPartiallySupported = tempStatus.IsPartiallySupported;
p.SortStatus = result.SortStatus;
p.SearchParameterStatus = result.Status;

updated.Add(p);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public enum DataActions : ulong
Smart = 1 << 30, // Do not include Smart in the '*' case. We only want smart for a user if explicitly added to the role or user

[EnumMember(Value = "*")]
All = (Import << 1) - 1,
All = (SearchParameter << 1) - 1,
}
}

0 comments on commit 6525a6d

Please sign in to comment.