chenlica commented on code in PR #4136:
URL: https://github.com/apache/texera/pull/4136#discussion_r2659847258


##########
file-service/src/test/scala/org/apache/texera/service/MockLakeFS.scala:
##########
@@ -87,11 +99,44 @@ trait MockLakeFS extends ForAllTestContainer with 
BeforeAndAfterAll { self: Suit
 
   def lakefsBaseUrl: String = 
s"http://${lakefs.host}:${lakefs.mappedPort(8000)}"
   def minioEndpoint: String = s"http://${minio.host}:${minio.mappedPort(9000)}"
+  def lakefsApiBasePath: String = s"$lakefsBaseUrl/api/v1"
+
+  // ---- Clients (lazy so they initialize after containers are started) ----
+
+  lazy val lakefsApiClient: ApiClient = {
+    val apiClient = new ApiClient()
+    apiClient.setBasePath(lakefsApiBasePath)
+    // basic-auth for lakeFS API uses accessKey as username, secretKey as 
password
+    apiClient.setUsername(lakefsAccessKeyID)
+    apiClient.setPassword(lakefsSecretAccessKey)
+    apiClient
+  }
+
+  lazy val repositoriesApi: RepositoriesApi = new 
RepositoriesApi(lakefsApiClient)
+
+  /**
+    * S3 client pointed at MinIO.
+    *
+    * Notes:
+    * - Region can be any value for MinIO, but MUST match what your signing 
expects.
+    *   so we use that.
+    * - Path-style is important: http://host:port/bucket/key
+    */
+  lazy val s3Client: S3Client = {
+    val creds = AwsBasicCredentials.create("texera_minio", "password")

Review Comment:
   Please add a comment in the codebase to show they are temporary for testing.



##########
file-service/src/test/scala/org/apache/texera/service/MockLakeFS.scala:
##########
@@ -87,11 +99,44 @@ trait MockLakeFS extends ForAllTestContainer with 
BeforeAndAfterAll { self: Suit
 
   def lakefsBaseUrl: String = 
s"http://${lakefs.host}:${lakefs.mappedPort(8000)}"
   def minioEndpoint: String = s"http://${minio.host}:${minio.mappedPort(9000)}"
+  def lakefsApiBasePath: String = s"$lakefsBaseUrl/api/v1"
+
+  // ---- Clients (lazy so they initialize after containers are started) ----
+
+  lazy val lakefsApiClient: ApiClient = {
+    val apiClient = new ApiClient()
+    apiClient.setBasePath(lakefsApiBasePath)
+    // basic-auth for lakeFS API uses accessKey as username, secretKey as 
password
+    apiClient.setUsername(lakefsAccessKeyID)
+    apiClient.setPassword(lakefsSecretAccessKey)
+    apiClient
+  }
+
+  lazy val repositoriesApi: RepositoriesApi = new 
RepositoriesApi(lakefsApiClient)
+
+  /**
+    * S3 client pointed at MinIO.
+    *
+    * Notes:
+    * - Region can be any value for MinIO, but MUST match what your signing 
expects.
+    *   so we use that.
+    * - Path-style is important: http://host:port/bucket/key
+    */
+  lazy val s3Client: S3Client = {
+    val creds = AwsBasicCredentials.create("texera_minio", "password")
+    S3Client
+      .builder()
+      .endpointOverride(URI.create(StorageConfig.s3Endpoint)) // set in 
afterStart()
+      .region(Region.US_WEST_2)

Review Comment:
   If it's for testing, add a comment to the codebase.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to