Skip to content

Commit 29e5eb4

Browse files
committed
Fixes to integration tests.
1 parent 201b30b commit 29e5eb4

File tree

9 files changed

+50
-46
lines changed

9 files changed

+50
-46
lines changed

apps/altinn3-tilgang-service/src/main/resources/application-local.yml

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
ALTINN_URL: https://platform.tt02.altinn.no
21
MASKINPORTEN_CLIENT_ID: ef2960de-7fa6-4396-80a5-2eca00e4af28
3-
MASKINPORTEN_CLIENT_JWK: dummy
42
MASKINPORTEN_SCOPES: altinn:resourceregistry/accesslist.read altinn:resourceregistry/accesslist.write altinn:accessmanagement/authorizedparties.resourceowner
5-
MASKINPORTEN_WELL_KNOWN_URL: https://test.maskinporten.no/.well-known/oauth-authorization-server
63

74
spring:
85
cache:

apps/altinn3-tilgang-service/src/main/resources/application-virtual.yml

Whitespace-only changes.

apps/altinn3-tilgang-service/src/main/resources/application.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
spring:
22
application:
3-
version: application.version.todo
43
name: testnav-altinn3-tilgang-service
54
description: Tjeneste for å hente og sette tilganger for orgnisasjoner
65
security:
@@ -30,20 +29,19 @@ altinn:
3029

3130
management:
3231
endpoints:
33-
enabled-by-default: true
32+
access:
33+
default: read_only
3434
web:
3535
base-path: /internal
3636
exposure:
3737
include: prometheus,health
3838
path-mapping:
3939
prometheus: metrics
40-
endpoint:
41-
prometheus:
42-
enabled: true
4340
prometheus:
4441
metrics:
4542
export:
4643
enabled: true
44+
4745
server:
4846
servlet:
4947
encoding:

apps/altinn3-tilgang-service/src/main/resources/logback-spring.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<configuration>
3+
34
<springProfile name="prod,dev">
45
<appender name="stdout_json" class="ch.qos.logback.core.ConsoleAppender">
56
<encoder class="no.nav.testnav.libs.reactivecore.logging.TestnavLogbackEncoder">
@@ -13,7 +14,7 @@
1314
</root>
1415
</springProfile>
1516

16-
<springProfile name="local">
17+
<springProfile name="local,virtual">
1718
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
1819
<encoder>
1920
<pattern>

apps/bruker-service/src/main/resources/application-virtual.yml

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
spring:
2-
cloud:
3-
gcp:
4-
secretmanager:
5-
enabled: false
62
security:
73
oauth2:
84
resourceserver:
@@ -27,9 +23,4 @@ consumers:
2723
url: http://testnav-altinn3-tilgang-service:8080
2824
cluster: dev-gcp
2925
namespace: dolly
30-
name: testnav-altinn3-tilgang-service
31-
32-
TOKEN_X_WELL_KNOWN_URL: http://tokendings:8080/.well-known/oauth-authorization-server
33-
TOKEN_X_CLIENT_ID: dev-gcp:dolly:testnav-bruker-service
34-
JWT_SECRET: dummy
35-
CRYPTOGRAPHY_SECRET: DUMMY SUPER SECRET CRYPTOGRAPHY KEY THAT IS NOT SECURE
26+
name: testnav-altinn3-tilgang-service

apps/bruker-service/src/main/resources/application.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
spring:
22
application:
3-
version: application.version.todo
43
name: testnav-bruker-service
54
description: Tjeneste for brukere
65
security:
@@ -29,20 +28,19 @@ consumers:
2928

3029
management:
3130
endpoints:
32-
enabled-by-default: true
31+
access:
32+
default: read_only
3333
web:
3434
base-path: /internal
3535
exposure:
3636
include: prometheus,health
3737
path-mapping:
3838
prometheus: metrics
39-
endpoint:
40-
prometheus:
41-
enabled: true
4239
prometheus:
4340
metrics:
4441
export:
4542
enabled: true
43+
4644
server:
4745
servlet:
4846
encoding:

docker-compose.yml

+33-20
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,74 @@
11
services:
2+
23
testnav-altinn3-tilgang-service:
3-
container_name: testnav-altinn3-tilgang-service
4-
environment:
5-
- SPRING_PROFILES_ACTIVE=virtual
6-
- JAVA_TOOL_OPTIONS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
7-
- TOKEN_X_PRIVATE_JWK=${JWK}
8-
- MASKINPORTEN_CLIENT_JWK=${JWK}
9-
build:
10-
context: ./apps/altinn3-tilgang-service
114
depends_on:
125
- tokendings
136
- maskinporten
147
- altinn
8+
build:
9+
context: ./apps/altinn3-tilgang-service
10+
environment:
11+
- ALTINN_URL=http//altinn:8080
12+
- AZURE_OPENID_CONFIG_ISSUER=dummy
13+
- JAVA_TOOL_OPTIONS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
14+
- MASKINPORTEN_CLIENT_ID=dummy
15+
- MASKINPORTEN_CLIENT_JWK=${JWK}
16+
- MASKINPORTEN_SCOPES=altinn:resourceregistry/accesslist.read altinn:resourceregistry/accesslist.write altinn:accessmanagement/authorizedparties.resourceowner
17+
- MASKINPORTEN_WELL_KNOWN_URL=http://maskinporten:8080
18+
- SPRING_PROFILES_ACTIVE=virtual
19+
- TOKEN_X_ISSUER=http://tokendings:8080
20+
- TOKEN_X_PRIVATE_JWK=${JWK}
1521
ports:
1622
- "8001:8080"
1723
- "5001:5005"
24+
1825
tokendings:
19-
container_name: tokendings
2026
build:
2127
context: ./mocks/tokendings-mock
2228
environment:
2329
- JAVA_TOOL_OPTIONS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
30+
- SPRING_PROFILES_ACTIVE=virtual
2431
ports:
2532
- "9001:8080"
33+
2634
maskinporten:
27-
container_name: maskinporten
2835
build:
2936
context: ./mocks/maskinporten-mock
3037
environment:
3138
- JAVA_TOOL_OPTIONS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
39+
- SPRING_PROFILES_ACTIVE=virtual
3240
ports:
3341
- "9002:8080"
42+
3443
altinn:
3544
image: wiremock/wiremock
36-
container_name: altinn
3745
volumes:
3846
- ./mocks/altinn-mock/wiremock/__files:/home/wiremock/__files
3947
- ./mocks/altinn-mock/wiremock/mappings:/home/wiremock/mappings
48+
4049
testnav-bruker-service-db:
4150
image: postgres
42-
restart: always
43-
container_name: testnav-bruker-service-db
4451
environment:
4552
- POSTGRES_USER=compose-postgres
4653
- POSTGRES_PASSWORD=compose-postgres
54+
restart: always
55+
4756
testnav-bruker-service:
48-
container_name: testnav-bruker-service
49-
environment:
50-
- SPRING_PROFILES_ACTIVE=virtual
51-
- JAVA_TOOL_OPTIONS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
52-
- TOKEN_X_PRIVATE_JWK=${JWK}
53-
build:
54-
context: ./apps/bruker-service
5557
depends_on:
5658
- testnav-bruker-service-db
5759
- testnav-altinn3-tilgang-service
5860
- tokendings
61+
build:
62+
context: ./apps/bruker-service
63+
environment:
64+
- AZURE_OPENID_CONFIG_ISSUER=dummy
65+
- CRYPTOGRAPHY_SECRET=dummy
66+
- JAVA_TOOL_OPTIONS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
67+
- JWT_SECRET=dummy
68+
- SPRING_PROFILES_ACTIVE=virtual
69+
- TOKEN_X_CLIENT_ID=dev-gcp:dolly:testnav-bruker-service
70+
- TOKEN_X_PRIVATE_JWK=${JWK}
71+
- TOKEN_X_WELL_KNOWN_URL=http://tokendings:8080/.well-known/oauth-authorization-server
5972
ports:
6073
- "8002:8080"
6174
- "5002:5005"

libs/testing/src/main/java/no/nav/dolly/libs/nais/NaisEnvironmentApplicationContextInitializer.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ private static void configureForLocalProfile(Map<String, Object> properties) {
3434
log.info("Configuring environment for local profile using Secret Manager");
3535

3636
// Emulating NAIS provided environment variables.
37+
properties.putIfAbsent("ALTINN_URL", "${sm\\://altinn-url}"); // Used by altinn3-tilgang-service only.
3738
properties.putIfAbsent("AZURE_APP_CLIENT_ID", "${sm\\://azure-app-client-id}");
3839
properties.putIfAbsent("AZURE_APP_CLIENT_SECRET", "${sm\\://azure-app-client-secret}");
3940
properties.putIfAbsent("AZURE_OPENID_CONFIG_ISSUER", "${sm\\://azure-openid-config-issuer}");
@@ -64,7 +65,7 @@ private static void configureForTestProfile(Map<String, Object> properties) {
6465
"ALTINN_API_KEY",
6566
"ALTINN_URL",
6667
"AZURE_OPENID_CONFIG_ISSUER",
67-
"AZURE_OPENID_CONFIG_TOKEN_ENDPOINT", // CATO: Remove?
68+
"AZURE_OPENID_CONFIG_TOKEN_ENDPOINT",
6869
"CRYPTOGRAPHY_SECRET", // Used by bruker-service only.
6970
"IDPORTEN_CLIENT_ID", // Used by dolly-frontend only.
7071
"IDPORTEN_CLIENT_JWK", // Used by dolly-frontend only.
@@ -86,6 +87,7 @@ private static void configureForOtherProfiles(Map<String, Object> properties) {
8687
log.info("Configuring environment for non-test, non-local profiles");
8788

8889
properties.putIfAbsent("spring.main.banner-mode", "off");
90+
properties.putIfAbsent("spring.cloud.gcp.secretmanager.enabled", "false"); // Unless we actually start using Secret Manager in deployment.
8991

9092
}
9193

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
spring:
22
application:
3-
name: maskinporten-mock
3+
name: maskinporten-mock
4+
cloud:
5+
gcp:
6+
secretmanager:
7+
enabled: false

0 commit comments

Comments
 (0)