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

KOGITO-9855: Avoid create protobuf folder with root privileges. Fix p… #1891

Merged
merged 2 commits into from
Oct 30, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
package org.kie.kogito.index.test.containers;

import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

import org.kie.kogito.test.resources.TestResource;
import org.kie.kogito.testcontainers.KogitoGenericContainer;
Expand Down Expand Up @@ -48,9 +53,20 @@ public void setKafkaURL(String kafkaURL) {
public void addProtoFileFolder() {
String pathStr = "target/classes/META-INF/resources/persistence/protobuf/";
String absolutePath = new File(pathStr).getAbsolutePath();
createIfNotExists(absolutePath);
withFileSystemBind(absolutePath, "/home/kogito/data/protobufs/", BindMode.READ_ONLY);
}

public Path createIfNotExists(String absolutePath) {
Path path = Paths.get(absolutePath);
try {
Files.createDirectories(path);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
return path;
}

@Override
public int getMappedPort() {
return getMappedPort(PORT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ class PostgreSQLQuarkusAddonDataIndexPersistenceIT {

@Test
void testDataIndexAddon() {
String processDefId = "hello";
given().contentType(ContentType.JSON)
.baseUri(dataIndex)
.body("{ \"query\" : \"{ ProcessDefinitions{ id, name, version, endpoint, addons, source, nodes { id, name, type, uniqueId, metadata { UniqueId } } } }\" }")
.body("{ \"query\" : \"{ ProcessDefinitions (where: { id: {equal: \\\"" + processDefId
+ "\\\"}}){ id, name, version, endpoint, addons, source, nodes { id, name, type, uniqueId, metadata { UniqueId } } } }\" }")
.when().post("/graphql")
.then().log().ifValidationFails().statusCode(200)
.body("data.ProcessDefinitions[0].id", is("hello"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ class PostgreSQLQuarkusAddonDataIndexPersistenceIT {

@Test
void testDataIndexAddon() {
String processDefId = "greet";
String source = given().contentType(ContentType.JSON)
.baseUri(dataIndex)
.body("{ \"query\" : \"{ ProcessDefinitions{ id, name, version, endpoint, addons, source, nodes { id, name, type, uniqueId, metadata { UniqueId } } } }\" }")
.body("{ \"query\" : \"{ ProcessDefinitions(where: { id: {equal: \\\"" + processDefId
+ "\\\"}}){ id, name, version, endpoint, addons, source, nodes { id, name, type, uniqueId, metadata { UniqueId } } } }\" }")
.when().post("/graphql")
.then().log().ifValidationFails().statusCode(200)
.body("data.ProcessDefinitions[0].id", is("greet"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ class PostgreSQLQuarkusAddonDataIndexIT {

@Test
void testDataIndexAddon() {
given().contentType(ContentType.JSON).body("{ \"query\" : \"{ProcessDefinitions{ id, version, name } }\" }")
String processDefId = "hello";
given().contentType(ContentType.JSON).body("{ \"query\" : \"{ProcessDefinitions(where: { id: {equal: \\\"" + processDefId +
"\\\"}}){ id, version, name } }\" }")
.when().post("/graphql")
.then().statusCode(200)
.body("data.ProcessDefinitions.size()", is(1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class PostgreSQLQuarkusAddonDataIndexIT {

@Test
void testDataIndexAddon() {
given().contentType(ContentType.JSON).body("{ \"query\" : \"{ProcessDefinitions{ id, version, name } }\" }")
String processDefId = "greet";
given().contentType(ContentType.JSON).body("{ \"query\" : \"{ProcessDefinitions(where: { id: {equal: \\\"" + processDefId +
"\\\"}}){ id, version, name } }\" }")
.when().post("/graphql")
.then().statusCode(200)
.body("data.ProcessDefinitions.size()", is(1))
Expand Down