Skip to content

Add the s3 integrationt test #1092

Closed
Closed

Description

@openinx

Currently, I see our UCSingleCatalog use a CredentialTestFileSystem which built on top of the RawLocalFileSystem to mock the S3AFileSystem, AbsFileSystem, and GCPFileSystem.

I think it's reasonable for the unit test, but it actually not reflect the real s3/gcp/azure object storage. I think we can add a real integration tests for that. It's not necessary to run for every PR, but it's good to run those test in a real s3/gcp/azure object storage, for the release.

Then we can detect the the potential issue before the release. Open an issue here, will try to initial a PR for that when I have the time to do it.

Activity

  1. openinx commented on Oct 14, 2025

    @openinx
    CollaboratorAuthor

    Located a pontential risk in this issue, when I tried to pass the IT tests: #1112

  2. openinx commented on Oct 14, 2025

    @openinx
    CollaboratorAuthor

    Another potential risks is: for the IT test, seems like the OSS UC server will issue an aws credentials without any expiration time. maybe I need to investigate more about this.

    After the investigation, so the problem is the OSS UC server will return the static accessKey, secretKey, sessionToken without expiration time.

    if (s3StorageConfig.getSessionToken() != null && !s3StorageConfig.getSessionToken().isEmpty()) {
    // if a session token was supplied, then we will just return static session credentials
    return Credentials.builder()
    .accessKeyId(s3StorageConfig.getAccessKey())
    .secretAccessKey(s3StorageConfig.getSecretKey())
    .sessionToken(s3StorageConfig.getSessionToken())
    .build();
    }

    So I think we also need to handle the static accessKey, secretKey, sessionToken info in the credentials provider..

  3. changed the title [-]Add the s3/gcp/zure integrationt test[/-] [+]Add the s3 integrationt test[/+] on Oct 30, 2025
  4. openinx commented on Oct 30, 2025

    @openinx
    CollaboratorAuthor

    Let's just make this issue to be focused on aws s3.

  5. openinx commented on Oct 30, 2025

    @openinx
    CollaboratorAuthor

    I just use this command to test the integration test #1119

    export CATALOG_URI=$UC_URI &&\
    export CATALOG_AUTH_TOKEN=$UC_TOKEN &&\
    export CATALOG_NAME=main &&\
    export SCHEMA_NAME=demo_zh &&\
    export TABLE_NAME=ittest &&\
    export S3_BASE_LOCATION=$S3_LOCATION && \
    SBT_OPTS="-Xmx8G -XX:+UseG1GC" \
    ./build/sbt "integrationTests/testOnly io.unitycatalog.integrationtests.SparkCredentialRenewalTest"
  6. openinx commented on Oct 30, 2025

    @openinx
    CollaboratorAuthor

    When I did the integration tests, I encountered this issue:

    [error] Test io.unitycatalog.integrationtests.SparkCredentialRenewalTest failed: java.io.IOException: Class class io.unitycatalog.spark.auth.AwsVendedTokenProvider does not implement AWSCredentialsProvider, took 3.385s
    [error]     at org.apache.hadoop.fs.s3a.S3AUtils.createAWSCredentialProvider(S3AUtils.java:694)
    [error]     at org.apache.hadoop.fs.s3a.S3AUtils.buildAWSProviderList(S3AUtils.java:659)
    [error]     at org.apache.hadoop.fs.s3a.S3AUtils.createAWSCredentialProviderSet(S3AUtils.java:585)
    [error]     at org.apache.hadoop.fs.s3a.S3AFileSystem.bindAWSClient(S3AFileSystem.java:959)
    [error]     at org.apache.hadoop.fs.s3a.S3AFileSystem.initialize(S3AFileSystem.java:586)
    [error]     at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:3611)
    [error]     at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:554)
    [error]     at org.apache.hadoop.fs.Path.getFileSystem(Path.java:365)
    [error]     at org.apache.spark.sql.delta.DeltaLog$.apply(DeltaLog.scala:966)
    [error]     at org.apache.spark.sql.delta.DeltaLog$.forTable(DeltaLog.scala:801)
    [error]     at org.apache.spark.sql.delta.commands.CreateDeltaTableCommand.run(CreateDeltaTableCommand.scala:134)
    [error]     at org.apache.spark.sql.delta.catalog.DeltaCatalog.$anonfun$createDeltaTable$1(DeltaCatalog.scala:223)
    [error]     at org.apache.spark.sql.delta.metering.DeltaLogging.recordFrameProfile(DeltaLogging.scala:171)
    [error]     at org.apache.spark.sql.delta.metering.DeltaLogging.recordFrameProfile$(DeltaLogging.scala:169)
    [error]     at org.apache.spark.sql.delta.catalog.DeltaCatalog.recordFrameProfile(DeltaCatalog.scala:69)
    [error]     at org.apache.spark.sql.delta.catalog.DeltaCatalog.org$apache$spark$sql$delta$catalog$DeltaCatalog$$createDeltaTable(DeltaCatalog.scala:105)
    [error]     at org.apache.spark.sql.delta.catalog.DeltaCatalog.$anonfun$createTable$1(DeltaCatalog.scala:372)
    [error]     at org.apache.spark.sql.delta.metering.DeltaLogging.recordFrameProfile(DeltaLogging.scala:171)
    [error]     at org.apache.spark.sql.delta.metering.DeltaLogging.recordFrameProfile$(DeltaLogging.scala:169)
    [error]     at org.apache.spark.sql.delta.catalog.DeltaCatalog.recordFrameProfile(DeltaCatalog.scala:69)
    [error]     at org.apache.spark.sql.delta.catalog.DeltaCatalog.createTable(DeltaCatalog.scala:352)
    [error]     at org.apache.spark.sql.delta.catalog.DeltaCatalog.createTable(DeltaCatalog.scala:343)
    [error]     at io.unitycatalog.spark.UCSingleCatalog.createTable(UCSingleCatalog.scala:133)
    [error]     at org.apache.spark.sql.execution.datasources.v2.CreateTableExec.run(CreateTableExec.scala:46)
    [error]     at org.apache.spark.sql.execution.datasources.v2.V2CommandExec.result$lzycompute(V2CommandExec.scala:43)
    [error]     at org.apache.spark.sql.execution.datasources.v2.V2CommandExec.result(V2CommandExec.scala:43)
    [error]     at org.apache.spark.sql.execution.datasources.v2.V2CommandExec.executeCollect(V2CommandExec.scala:49)
    [error]     at org.apache.spark.sql.execution.QueryExecution.$anonfun$eagerlyExecuteCommands$2(QueryExecution.scala:155)
    [error]     at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId0$8(SQLExecution.scala:162)
    [error]     at org.apache.spark.sql.execution.SQLExecution$.withSessionTagsApplied(SQLExecution.scala:268)
    [error]     at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId0$7(SQLExecution.scala:124)
    [error]     at org.apache.spark.JobArtifactSet$.withActiveJobArtifactState(JobArtifactSet.scala:94)
    [error]     at org.apache.spark.sql.artifact.ArtifactManager.$anonfun$withResources$1(ArtifactManager.scala:112)
    [error]     at org.apache.spark.sql.artifact.ArtifactManager.withClassLoaderIfNeeded(ArtifactManager.scala:106)
    [error]     at org.apache.spark.sql.artifact.ArtifactManager.withResources(ArtifactManager.scala:111)
    [error]     at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId0$6(SQLExecution.scala:124)
    [error]     at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:291)
    [error]     at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId0$1(SQLExecution.scala:123)
    [error]     at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:804)
    [error]     at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId0(SQLExecution.scala:77)
    [error]     at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:233)
    [error]     at org.apache.spark.sql.execution.QueryExecution.$anonfun$eagerlyExecuteCommands$1(QueryExecution.scala:155)
    [error]     at org.apache.spark.sql.execution.QueryExecution$.withInternalError(QueryExecution.scala:654)
    [error]     at org.apache.spark.sql.execution.QueryExecution.org$apache$spark$sql$execution$QueryExecution$$eagerlyExecute$1(QueryExecution.scala:154)
    [error]     at org.apache.spark.sql.execution.QueryExecution$$anonfun$eagerlyExecuteCommands$3.applyOrElse(QueryExecution.scala:169)
    [error]     at org.apache.spark.sql.execution.QueryExecution$$anonfun$eagerlyExecuteCommands$3.applyOrElse(QueryExecution.scala:164)
    [error]     at org.apache.spark.sql.catalyst.trees.TreeNode.$anonfun$transformDownWithPruning$1(TreeNode.scala:470)
    [error]     at org.apache.spark.sql.catalyst.trees.CurrentOrigin$.withOrigin(origin.scala:86)
    [error]     at org.apache.spark.sql.catalyst.trees.TreeNode.transformDownWithPruning(TreeNode.scala:470)
    [error]     at org.apache.spark.sql.catalyst.plans.logical.LogicalPlan.org$apache$spark$sql$catalyst$plans$logical$AnalysisHelper$$super$transformDownWithPruning(LogicalPlan.scala:37)
    [error]     at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.transformDownWithPruning(AnalysisHelper.scala:360)
    [error]     at org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.transformDownWithPruning$(AnalysisHelper.scala:356)
    [error]     at org.apache.spark.sql.catalyst.plans.logical.LogicalPlan.transformDownWithPruning(LogicalPlan.scala:37)
    [error]     at org.apache.spark.sql.catalyst.plans.logical.LogicalPlan.transformDownWithPruning(LogicalPlan.scala:37)
    [error]     at org.apache.spark.sql.catalyst.trees.TreeNode.transformDown(TreeNode.scala:446)
    [error]     at org.apache.spark.sql.execution.QueryExecution.eagerlyExecuteCommands(QueryExecution.scala:164)
    [error]     at org.apache.spark.sql.execution.QueryExecution.$anonfun$lazyCommandExecuted$1(QueryExecution.scala:126)
    [error]     at scala.util.Try$.apply(Try.scala:217)
    [error]     at org.apache.spark.util.Utils$.doTryWithCallerStacktrace(Utils.scala:1378)
    [error]     at org.apache.spark.util.Utils$.getTryWithCallerStacktrace(Utils.scala:1439)
    [error]     at org.apache.spark.util.LazyTry.get(LazyTry.scala:58)
    [error]     at org.apache.spark.sql.execution.QueryExecution.commandExecuted(QueryExecution.scala:131)
    [error]     at org.apache.spark.sql.classic.Dataset.<init>(Dataset.scala:277)
    [error]     at org.apache.spark.sql.classic.Dataset$.$anonfun$ofRows$5(Dataset.scala:140)
    [error]     at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:804)
    [error]     at org.apache.spark.sql.classic.Dataset$.ofRows(Dataset.scala:136)
    [error]     at org.apache.spark.sql.classic.SparkSession.$anonfun$sql$4(SparkSession.scala:499)
    [error]     at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:804)
    [error]     at org.apache.spark.sql.classic.SparkSession.sql(SparkSession.scala:490)
    [error]     at org.apache.spark.sql.classic.SparkSession.sql(SparkSession.scala:504)
    [error]     at org.apache.spark.sql.classic.SparkSession.sql(SparkSession.scala:513)
    [error]     at org.apache.spark.sql.classic.SparkSession.sql(SparkSession.scala:91)
    [error]     at io.unitycatalog.integrationtests.SparkCredentialRenewalTest.sql(SparkCredentialRenewalTest.java:70)
    [error]     at io.unitycatalog.integrationtests.SparkCredentialRenewalTest.beforeAll(SparkCredentialRenewalTest.java:49)
    [error]     at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    [error]     at java.lang.reflect.Method.invoke(Method.java:580)
    [error]     ...

    I think this is an issue that we did not aware before when we did the locally running integration tests, since we use the hadoop-aws with 3.4.0 version by default.

    And for our integration-tests we actually use hadoop 3.3.6 version, which is still using the old version of the aws sdk.

    We can see here, for the hadoop 3.4.0, we actually are using the CredentialsProvider from the software.amazon.awssdk.auth.credentials.AwsCredentialsProvider

    https://github.com/apache/hadoop/blob/branch-3.4.0/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/auth/CredentialProviderListFactory.java#L36

    While for the hadoop 3.3.6, we actually are using the CredentialsProvider from the com.amazonaws.auth.AWSCredentialsProvider, which is different with the new version's software.amazon.awssdk.auth.credentials.AwsCredentialsProvider.

    https://github.com/apache/hadoop/blob/rel/release-3.3.6/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AUtils.java#L27

    Then for our AwsVendedTokenProvider, we may need to support both of the hadoop version, which means we need to implement both the credentials providers.

  7. openinx commented on Oct 31, 2025

    @openinx
    CollaboratorAuthor

    Also I tried to run this #1119 with renewalCredential.enabled=false, to convince it will fail the job once the expiratiom time is arrived.

    The full command to test the job is here:

    nohup env \
      CATALOG_URI="$UC_URI" \
      CATALOG_AUTH_TOKEN="$UC_TOKEN" \
      CATALOG_NAME="main" \
      SCHEMA_NAME="demo_zh" \
      TABLE_NAME="ittest" \
      S3_BASE_LOCATION="$UC_S3_LOCATION" \
      CREDENTIAL_RENEWAL_TEST_RENEWAL_ENABLED=false \
      CREDENTIAL_RENEWAL_TEST_ROW_COUNT=10000000000 \
      SBT_OPTS="-Xmx8G -XX:+UseG1GC" \
      "$PWD/build/sbt" "integrationTests/testOnly io.unitycatalog.integrationtests.SparkCredentialRenewalTest" \
      >> ~/bench.log 2>&1 &

    And the log says, the job started at 2025/10/30 21:43:06, and the it failed at 2025/10/30 22:43:21, which was exactly 1 hour, correctly matching the credential expiration time.

    The full stack trace is here:

    [error] org.apache.spark.SparkException: [TASK_WRITE_FAILED] Task failed while writing rows to s3://us-east-1-dev-account-staging-uc-ext-loc-bucket-1/brickfood-tests/zhenghu/20251030/
    e190f5a1-081e-406b-b70d-093edebdd58b/part-00000-aa714000-1fad-4886-b24a-a8bce4a868d9-c000.snappy.parquet. SQLSTATE: 58030
    [error]         at org.apache.spark.sql.errors.QueryExecutionErrors$.taskFailedWhileWritingRowsError(QueryExecutionErrors.scala:772)
    [error]         at org.apache.spark.sql.execution.datasources.FileFormatDataWriter.enrichWriteError(FileFormatDataWriter.scala:92)
    [error]         at org.apache.spark.sql.execution.datasources.FileFormatDataWriter.writeWithMetrics(FileFormatDataWriter.scala:103)
    [error]         at org.apache.spark.sql.execution.datasources.FileFormatDataWriter.writeWithIterator(FileFormatDataWriter.scala:111)
    [error]         at org.apache.spark.sql.delta.files.DeltaFileFormatWriter$.$anonfun$executeTask$1(DeltaFileFormatWriter.scala:452)
    [error]         at org.apache.spark.util.Utils$.tryWithSafeFinallyAndFailureCallbacks(Utils.scala:1323)
    [error]         at org.apache.spark.sql.delta.files.DeltaFileFormatWriter$.executeTask(DeltaFileFormatWriter.scala:459)
    [error]         at org.apache.spark.sql.delta.files.DeltaFileFormatWriter$.$anonfun$executeWrite$3(DeltaFileFormatWriter.scala:281)
    [error]         at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:93)
    [error]         at org.apache.spark.TaskContext.runTaskWithListeners(TaskContext.scala:171)
    [error]         at org.apache.spark.scheduler.Task.run(Task.scala:147)
    [error]         at org.apache.spark.executor.Executor$TaskRunner.$anonfun$run$5(Executor.scala:647)
    [error]         at org.apache.spark.util.SparkErrorUtils.tryWithSafeFinally(SparkErrorUtils.scala:80)
    [error]         at org.apache.spark.util.SparkErrorUtils.tryWithSafeFinally$(SparkErrorUtils.scala:77)
    [error]         at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:99)
    [error]         at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:650)
    [error]         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    [error]         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    [error]         at java.base/java.lang.Thread.run(Thread.java:1583)
    [error] Caused by: org.apache.hadoop.fs.s3a.AWSBadRequestException: upload part #966 upload ID 4nOvuNX3EVLbcmSDtRZiEXpioqW07zVo7HEU9_5lExwycHXdmOMe3FTlI08ynDcFJEhI82lWDkGk1lEqL6.j2kSy
    f8XV5nTdBZLnC3GI6OAp1MB9SLUpvmx35Z3XBBGipYavlKV9xkZX8saB47ZWeKVizlzO8gsZ3Hde3l6zujMlCnGgRVmH_wyaJsUGSrQb on brickfood-tests/zhenghu/20251030/e190f5a1-081e-406b-b70d-093edebdd58b/part-
    00000-aa714000-1fad-4886-b24a-a8bce4a868d9-c000.snappy.parquet: software.amazon.awssdk.services.s3.model.S3Exception: The provided token has expired. (Service: S3, Status Code: 400, R
    equest ID: F17WA9VEG4QHMJFH, Extended Request ID: 11qsvyW42K3maNxyct1OSyNNRSvbxDUAfQdChyAL0glzyPEind6UNNoX4iPRpYEayaVPwX54pkg=):ExpiredToken: The provided token has expired. (Service:
     S3, Status Code: 400, Request ID: F17WA9VEG4QHMJFH, Extended Request ID: 11qsvyW42K3maNxyct1OSyNNRSvbxDUAfQdChyAL0glzyPEind6UNNoX4iPRpYEayaVPwX54pkg=)
    [error]         at org.apache.hadoop.fs.s3a.S3AUtils.translateException(S3AUtils.java:260)
    [error]         at org.apache.hadoop.fs.s3a.Invoker.once(Invoker.java:124)
    [error]         at org.apache.hadoop.fs.s3a.Invoker.lambda$retry$4(Invoker.java:376)
    [error]         at org.apache.hadoop.fs.s3a.Invoker.retryUntranslated(Invoker.java:468)
    [error]         at org.apache.hadoop.fs.s3a.Invoker.retry(Invoker.java:372)
    [error]         at org.apache.hadoop.fs.s3a.Invoker.retry(Invoker.java:347)
    [error]         at org.apache.hadoop.fs.s3a.WriteOperationHelper.retry(WriteOperationHelper.java:205)
    [error]         at org.apache.hadoop.fs.s3a.WriteOperationHelper.uploadPart(WriteOperationHelper.java:592)
    [error]         at org.apache.hadoop.fs.s3a.S3ABlockOutputStream$MultiPartUpload.lambda$uploadBlockAsync$1(S3ABlockOutputStream.java:911)
    [error]         at org.apache.hadoop.thirdparty.com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTa
    sk.java:131)
    [error]         at org.apache.hadoop.thirdparty.com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:75)
    [error]         at org.apache.hadoop.thirdparty.com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
    [error]         at org.apache.hadoop.util.SemaphoredDelegatingExecutor$RunnableWithPermitRelease.run(SemaphoredDelegatingExecutor.java:225)
    [error]         at org.apache.hadoop.util.SemaphoredDelegatingExecutor$RunnableWithPermitRelease.run(SemaphoredDelegatingExecutor.java:225)
    [error]         ... 3 more

    This correctly verified that our credential renewal really seamlessly working pretty good without breaking user's spark job.

  8. openinx commented on Nov 6, 2025

    @openinx
    CollaboratorAuthor

    Closed via #1119

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions