Skip to content

Commit 39fa86e

Browse files
improve e2e test
1 parent 4f2c194 commit 39fa86e

5 files changed

Lines changed: 77 additions & 33 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
meta {
2+
name: Get open dataflow by ID
3+
type: http
4+
seq: 9
5+
}
6+
7+
get {
8+
url: {{CONSUMER_DP}}/api/proxy/flows
9+
body: json
10+
auth: none
11+
}
12+
13+
body:text {
14+
{
15+
"@context": [
16+
"https://w3id.org/edc/connector/management/v2"
17+
],
18+
"@type": "QuerySpec"
19+
}
20+
}
21+
22+
script:post-response {
23+
const body = res.getBody()
24+
const map = new Map(Object.entries(body));
25+
// just use the first entry in the map
26+
const [flowId, address] = map.entries().next().value;
27+
28+
expect(flowId).not.to.be.undefined
29+
bru.setVar("flowId",flowId)
30+
31+
32+
}
33+
34+
settings {
35+
encodeUrl: true
36+
timeout: 0
37+
}

k8s/issuer/application/issuerservice-seed-job.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ metadata:
2222
labels:
2323
app: issuerservice-seed
2424
platform: edcv
25-
type: edcv-job
25+
type: edc-job
2626
spec:
2727
backoffLimit: 5
2828
template:
2929
metadata:
3030
labels:
3131
app: issuerservice-seed
3232
platform: edcv
33-
type: edcv-job
33+
type: edc-job
3434
spec:
3535
restartPolicy: OnFailure
3636
initContainers:

launchers/dataplane/src/main/java/org/eclipse/edc/mvd/dataplane/data/ConsumerProxyController.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,17 @@ public ConsumerProxyController(ConsumerDataHandler consumerDataHandler) {
3535
}
3636

3737
@GET
38-
@Path("/{flowId}")
38+
@Path("/{flowId}/data")
3939
public String handleDataFlow(@PathParam("flowId") String flowId) {
4040
return consumerDataHandler.downloadData(flowId).orElseThrow(ExceptionMapper.MAP_TO_WSRS);
4141
}
4242

43+
@GET
44+
@Path("/{flowId}")
45+
public DataAddress getFlowMetadata(@PathParam("flowId") String flowId) {
46+
return consumerDataHandler.getFlow(flowId);
47+
}
48+
4349
@GET
4450
public Map<String, DataAddress> getAll() {
4551
return consumerDataHandler.getAllFlows();

launchers/dataplane/src/main/java/org/eclipse/edc/mvd/dataplane/signaling/ConsumerDataHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,8 @@ public Result<String> downloadData(String flowId) {
7878
public Map<String, DataAddress> getAllFlows() {
7979
return ongoingTransfers;
8080
}
81+
82+
public DataAddress getFlow(String flowId) {
83+
return ongoingTransfers.get(flowId);
84+
}
8185
}

tests/end2end/src/test/java/org/eclipse/edc/demo/tests/transfer/TransferEndToEndTest.java

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,11 @@
4545
public class TransferEndToEndTest {
4646
// Management API base URL of the consumer connector, goes through Ingress controller
4747
private static final String CONSUMER_MANAGEMENT_URL = "http://cp.consumer.localhost:8080";
48-
// Catalog Query API URL of the consumer connector, goes through ingress controller
49-
private static final String CONSUMER_CATALOG_URL = "http://127.0.0.1/consumer/fc";
5048
// DSP service URL of the provider, not reachable outside the cluster
5149
private static final String PROVIDER_DSP_URL = "http://controlplane.provider.svc.cluster.local:8082/api/dsp/2025-1";
5250
// DID of the provider company
5351
private static final String PROVIDER_ID = "did:web:identityhub.provider.svc.cluster.local%3A7083:provider";
54-
// public API endpoint of the provider-qna connector, goes through the ingress controller
55-
private static final String PROVIDER_PUBLIC_URL = "http://dp.provider.localhost:8080/public";
52+
private static final String CONSUMER_PROXY_URL = "http://dp.consumer.localhost:8080/api/proxy";
5653
private static final String PROVIDER_MANAGEMENT_URL = "http://cp.provider.localhost:8080";
5754

5855
private final TypeTransformerRegistry transformerRegistry = new TypeTransformerRegistryImpl();
@@ -69,23 +66,23 @@ private static RequestSpecification baseRequest() {
6966
@DisplayName("Tests a successful End-to-End contract negotiation and data transfer")
7067
@Test
7168
void transferData_hasPermission_shouldTransferData() {
72-
System.out.println("Waiting for Provider dataplane to come online");
73-
// wait until provider's dataplane is available
74-
await().atMost(TEST_TIMEOUT_DURATION)
75-
.pollDelay(TEST_POLL_DELAY)
76-
.untilAsserted(() -> {
77-
var jp = baseRequest()
78-
.get(PROVIDER_MANAGEMENT_URL + "/api/mgmt/v4/dataplanes")
79-
.then()
80-
.statusCode(200)
81-
.log().ifValidationFails()
82-
.extract().body().jsonPath();
83-
84-
var state = jp.getString("state");
85-
assertThat(state).isEqualTo("[REGISTERED]");
86-
});
87-
88-
System.out.println("Provider dataplane is online, fetching catalog");
69+
// System.out.println("Waiting for Provider dataplane to come online");
70+
// // wait until provider's dataplane is available
71+
// await().atMost(TEST_TIMEOUT_DURATION)
72+
// .pollDelay(TEST_POLL_DELAY)
73+
// .untilAsserted(() -> {
74+
// var jp = baseRequest()
75+
// .get(PROVIDER_MANAGEMENT_URL + "/api/mgmt/v4/dataplanes")
76+
// .then()
77+
// .statusCode(200)
78+
// .log().ifValidationFails()
79+
// .extract().body().jsonPath();
80+
//
81+
// var state = jp.getString("state");
82+
// assertThat(state).isEqualTo("[REGISTERED]");
83+
// });
84+
//
85+
// System.out.println("Provider dataplane is online, fetching catalog");
8986

9087
var catalogRequestBody = Json.createObjectBuilder()
9188
.add("@context", Json.createObjectBuilder().add("edc", "https://w3id.org/edc/connector/management/v2"))
@@ -178,36 +175,36 @@ void transferData_hasPermission_shouldTransferData() {
178175
assertThat(jp.getString("state")).contains("STARTED");
179176
});
180177

181-
System.out.printf("Fetch EDR with ID %s%n", transferProcessId);
178+
System.out.printf("Fetch dataflow with ID %s from custom proxy%n", transferProcessId);
182179
// fetch EDR for transfer processs
183180
var endpoint = new AtomicReference<String>();
184181
var token = new AtomicReference<String>();
185182
await().atMost(TEST_TIMEOUT_DURATION)
186183
.pollDelay(TEST_POLL_DELAY)
187184
.untilAsserted(() -> {
188185
var jp = baseRequest()
189-
.get(CONSUMER_MANAGEMENT_URL + "/api/mgmt/v3/edrs/%s/dataaddress".formatted(transferProcessId))
186+
.get(CONSUMER_PROXY_URL + "/flows/%s".formatted(transferProcessId))
190187
.then()
191188
.log().ifValidationFails()
192189
.statusCode(200)
193-
.onFailMessage("Expected to find an EDR with transfer ID %s but did not!".formatted(transferProcessId))
190+
.onFailMessage("Expected to find a DataFlow ID %s but did not!".formatted(transferProcessId))
194191
.extract().body().jsonPath();
195192

196193
endpoint.set(jp.getString("endpoint"));
197-
token.set(jp.getString("authorization"));
194+
// token.set(jp.getString("authorization"));
198195

199-
assertThat(endpoint.get()).isNotNull().endsWith("/api/public");
200-
assertThat(token.get()).isNotNull();
196+
assertThat(endpoint.get()).isNotNull().endsWith("/api/public/data/source");
197+
// assertThat(token.get()).isNotNull();
201198
});
202199

203200
//download exemplary JSON data from public endpoint
204201
var response = given()
205-
.header("Authorization", token.get())
206-
.get(PROVIDER_PUBLIC_URL + "/api/public")
202+
// .header("Authorization", token.get())
203+
.get(CONSUMER_PROXY_URL + "/flows/%s/data".formatted(transferProcessId))
207204
.then()
208205
.log().ifError()
209206
.statusCode(200)
210-
.extract().body().asString();
207+
.extract().body().as(Object[].class);
211208

212209
assertThat(response).isNotEmpty();
213210
}

0 commit comments

Comments
 (0)