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

Update load of search param status on initialization #4711

Merged
merged 7 commits into from
Nov 6, 2024
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
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated a unit test to cover this case.

{
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,
}
}