-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: added skaffold * fix: run count queries sequentially to reduce load on the FHIR server * chore: removed stylecop * ci: added pre-commit to lint workflow * ci: moved lint inside ci workflow * style: fixed missing eol * ci: added skaffold run * ci: fixed ci * ci: use skaffold action * ci: update * ci: added e2e tests * ci print pods * ci: removed skaffold e2e test * ci: fix
- Loading branch information
Showing
15 changed files
with
251 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
* | ||
!src | ||
src/*/bin | ||
src/*/obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,29 @@ on: | |
branches: [master] | ||
|
||
jobs: | ||
lint: | ||
name: Lint Code Base | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
with: | ||
# Full git history is needed to get a proper list of changed files within `super-linter` | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v2 | ||
- name: Run pre-commit | ||
uses: pre-commit/[email protected] | ||
# temp disabled until https://github.com/replicatedhq/dockerfilelint/issues/169 | ||
# - name: Lint code base | ||
# uses: github/super-linter@v3 | ||
# env: | ||
# VALIDATE_ALL_CODEBASE: false | ||
# DEFAULT_BRANCH: master | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
build: | ||
name: Build | ||
runs-on: ubuntu-20.04 | ||
needs: lint | ||
steps: | ||
- name: Docker meta | ||
id: docker_meta | ||
|
@@ -22,8 +42,8 @@ jobs: | |
quay.io/chgl/fhir-server-exporter | ||
ghcr.io/chgl/fhir-server-exporter | ||
tag-sha: true | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
# - name: Set up QEMU | ||
# uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Login to DockerHub | ||
|
@@ -53,6 +73,12 @@ jobs: | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Run unit tests | ||
id: docker_build_unit_test | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: false | ||
target: test | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ obj/ | |
/wwwroot/node_modules | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/dotnetcore | ||
|
||
coverage.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: fhir-server | ||
labels: | ||
app.kubernetes.io/name: fhir-server | ||
spec: | ||
containers: | ||
- name: fhir-server | ||
image: ghcr.io/chgl/hapi/hapi-fhir-jpaserver-starter:5.2.0-distroless | ||
resources: | ||
limits: | ||
memory: "2Gi" | ||
cpu: "1000m" | ||
ports: | ||
- containerPort: 8080 | ||
name: http | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: fhir-server | ||
spec: | ||
selector: | ||
app.kubernetes.io/name: fhir-server | ||
ports: | ||
- port: 8080 | ||
targetPort: http | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: fhir-server-exporter | ||
labels: | ||
app.kubernetes.io/name: fhir-server-exporter | ||
spec: | ||
containers: | ||
- name: fhir-server-exporter | ||
image: fhir-server-exporter | ||
resources: | ||
limits: | ||
memory: "256Mi" | ||
cpu: "1000m" | ||
ports: | ||
- containerPort: 9797 | ||
name: metrics | ||
env: | ||
- name: FhirServerUrl | ||
value: http://fhir-server:8080/fhir | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: fhir-server-exporter | ||
spec: | ||
selector: | ||
app.kubernetes.io/name: fhir-server-exporter | ||
ports: | ||
- port: 9797 | ||
targetPort: metrics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: test-metrics | ||
spec: | ||
template: | ||
spec: | ||
automountServiceAccountToken: false | ||
containers: | ||
- name: curl | ||
image: curlimages/curl:latest | ||
command: ["/bin/sh", "-c"] | ||
args: | ||
- curl | ||
--retry-connrefuse | ||
--connect-timeout 10 | ||
--max-time 300 | ||
--retry 10 | ||
--retry-delay 10 | ||
http://fhir-server-exporter:9797/metrics | ||
restartPolicy: Never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: skaffold/v2beta12 | ||
kind: Config | ||
metadata: | ||
name: fhir-server-exporter | ||
build: | ||
local: | ||
useBuildkit: true | ||
artifacts: | ||
- image: fhir-server-exporter | ||
docker: | ||
dockerfile: Dockerfile | ||
deploy: | ||
kubectl: | ||
manifests: | ||
- hack/k8s/pods.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using FakeItEasy; | ||
using FluentAssertions; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.Logging; | ||
using Xunit; | ||
|
||
public class FhirExporterTests | ||
{ | ||
[Fact] | ||
public void Construct_WithMissingFhirServerUrl_ShouldThrow() | ||
{ | ||
Action construct = () => _ = new FhirExporter(A.Fake<ILogger<FhirExporter>>(), A.Fake<IConfiguration>()); | ||
|
||
construct.Should().Throw<InvalidOperationException>(); | ||
} | ||
|
||
[Fact] | ||
public void Construct_WithCorrectConfig_ShouldSucceed() | ||
{ | ||
var inMemorySettings = new Dictionary<string, string> | ||
{ | ||
{"FhirServerUrl", "http://localhost/fhir"}, | ||
}; | ||
|
||
var configuration = new ConfigurationBuilder() | ||
.AddInMemoryCollection(inMemorySettings) | ||
.Build(); | ||
|
||
var sut = new FhirExporter(A.Fake<ILogger<FhirExporter>>(), configuration); | ||
|
||
sut.Should().NotBeNull(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/FhirServerExporter.Tests/FhirServerExporter.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net5.0</TargetFramework> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="FakeItEasy" Version="6.2.1" /> | ||
<PackageReference Include="FluentAssertions" Version="6.0.0-alpha0002" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"/> | ||
<PackageReference Include="coverlet.collector" Version="3.0.3"/> | ||
<PackageReference Include="coverlet.msbuild" Version="3.0.3"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\FhirServerExporter\FhirServerExporter.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\..\.editorconfig" Link=".editorconfig" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.