|
16 | 16 |
|
17 | 17 | package com.iexec.sms.tee.config; |
18 | 18 |
|
19 | | -import com.iexec.commons.poco.tee.TeeFramework; |
20 | | -import com.iexec.sms.api.config.GramineServicesProperties; |
21 | | -import com.iexec.sms.api.config.SconeServicesProperties; |
22 | | -import com.iexec.sms.api.config.TeeAppProperties; |
23 | | -import com.iexec.sms.api.config.TeeServicesProperties; |
| 19 | +import com.iexec.sms.api.config.*; |
24 | 20 | import org.junit.jupiter.api.BeforeEach; |
25 | 21 | import org.junit.jupiter.api.Test; |
26 | 22 | import org.springframework.util.unit.DataSize; |
27 | 23 |
|
28 | | -import java.util.Arrays; |
| 24 | +import java.util.List; |
29 | 25 | import java.util.Map; |
30 | 26 |
|
31 | | -import static org.junit.jupiter.api.Assertions.*; |
| 27 | +import static org.assertj.core.api.Assertions.assertThat; |
32 | 28 |
|
33 | 29 | class TeeWorkerInternalConfigurationTests { |
34 | 30 | private static final String PRE_IMAGE = "preComputeImage"; |
@@ -65,7 +61,7 @@ void setUp() { |
65 | 61 | final TeeWorkerPipelineConfiguration.Pipeline additionalPipeline = getPipeline("v6"); |
66 | 62 |
|
67 | 63 | pipelineConfig = new TeeWorkerPipelineConfiguration( |
68 | | - Arrays.asList(pipeline, additionalPipeline) |
| 64 | + List.of(pipeline, additionalPipeline) |
69 | 65 | ); |
70 | 66 | } |
71 | 67 |
|
@@ -96,36 +92,41 @@ void shouldBuildGramineServicesPropertiesMap() { |
96 | 92 | final Map<String, TeeServicesProperties> multiPropertiesMap = |
97 | 93 | teeWorkerInternalConfiguration.gramineServicesPropertiesMap(pipelineConfig); |
98 | 94 |
|
99 | | - assertNotNull(multiPropertiesMap); |
100 | | - assertEquals(2, multiPropertiesMap.size()); |
| 95 | + assertThat(multiPropertiesMap).isNotNull() |
| 96 | + .extracting(Map::size) |
| 97 | + .isEqualTo(2); |
101 | 98 |
|
102 | | - final TeeServicesProperties properties = multiPropertiesMap.get(VERSION); |
103 | | - assertNotNull(properties); |
104 | | - assertInstanceOf(GramineServicesProperties.class, properties); |
105 | | - |
106 | | - final GramineServicesProperties gramineProperties = (GramineServicesProperties) properties; |
107 | | - assertEquals(TeeFramework.GRAMINE, gramineProperties.getTeeFramework()); |
108 | | - assertEquals(preComputeProperties, gramineProperties.getPreComputeProperties()); |
109 | | - assertEquals(postComputeProperties, gramineProperties.getPostComputeProperties()); |
| 99 | + assertThat(multiPropertiesMap.get(VERSION)) |
| 100 | + .usingRecursiveComparison() |
| 101 | + .isEqualTo(new GramineServicesProperties(VERSION, preComputeProperties, postComputeProperties)); |
110 | 102 | } |
111 | 103 |
|
112 | 104 | @Test |
113 | 105 | void shouldBuildSconeServicesPropertiesMap() { |
114 | 106 | final Map<String, TeeServicesProperties> multiPropertiesMap = |
115 | 107 | teeWorkerInternalConfiguration.sconeServicesPropertiesMap(pipelineConfig, LAS_IMAGE); |
116 | 108 |
|
117 | | - assertNotNull(multiPropertiesMap); |
118 | | - assertEquals(2, multiPropertiesMap.size()); |
| 109 | + assertThat(multiPropertiesMap).isNotNull() |
| 110 | + .extracting(Map::size) |
| 111 | + .isEqualTo(2); |
| 112 | + |
| 113 | + assertThat(multiPropertiesMap.get(VERSION)) |
| 114 | + .usingRecursiveComparison() |
| 115 | + .isEqualTo(new SconeServicesProperties(VERSION, preComputeProperties, postComputeProperties, LAS_IMAGE)); |
| 116 | + } |
| 117 | + |
| 118 | + @Test |
| 119 | + void shouldBuildTdxServicesPropertiesMap() { |
| 120 | + final Map<String, TeeServicesProperties> multiPropertiesMap = |
| 121 | + teeWorkerInternalConfiguration.tdxServicesPropertiesMap(pipelineConfig); |
119 | 122 |
|
120 | | - final TeeServicesProperties properties = multiPropertiesMap.get(VERSION); |
121 | | - assertNotNull(properties); |
122 | | - assertInstanceOf(SconeServicesProperties.class, properties); |
| 123 | + assertThat(multiPropertiesMap).isNotNull() |
| 124 | + .extracting(Map::size) |
| 125 | + .isEqualTo(2); |
123 | 126 |
|
124 | | - final SconeServicesProperties sconeProperties = (SconeServicesProperties) properties; |
125 | | - assertEquals(TeeFramework.SCONE, sconeProperties.getTeeFramework()); |
126 | | - assertEquals(preComputeProperties, sconeProperties.getPreComputeProperties()); |
127 | | - assertEquals(postComputeProperties, sconeProperties.getPostComputeProperties()); |
128 | | - assertEquals(LAS_IMAGE, sconeProperties.getLasImage()); |
| 127 | + assertThat(multiPropertiesMap.get(VERSION)) |
| 128 | + .usingRecursiveComparison() |
| 129 | + .isEqualTo(new TdxServicesProperties(VERSION, preComputeProperties, postComputeProperties)); |
129 | 130 | } |
130 | 131 |
|
131 | 132 | } |
0 commit comments