@VisibleForTesting
    String upload(Configuration config, String artifactUriStr)
            throws IOException, URISyntaxException {
        final URI artifactUri = PackagedProgramUtils.resolveURI(artifactUriStr);
        if (!"local".equals(artifactUri.getScheme())) {
            return artifactUriStr;
        }

        final String targetDir = config.get(KubernetesConfigOptions.LOCAL_UPLOAD_TARGET);
        checkArgument(
                !StringUtils.isNullOrWhitespaceOnly(targetDir),
                String.format(
                        "Setting '%s' to a valid remote path is required.",
                        KubernetesConfigOptions.LOCAL_UPLOAD_TARGET.key()));

        final FileSystem.WriteMode writeMode =
                config.get(KubernetesConfigOptions.LOCAL_UPLOAD_OVERWRITE)
                        ? FileSystem.WriteMode.OVERWRITE
                        : FileSystem.WriteMode.NO_OVERWRITE;

        final File src = new File(artifactUri.getPath());
        final Path target = new Path(targetDir, src.getName());
        if (target.getFileSystem().exists(target)
                && writeMode == FileSystem.WriteMode.NO_OVERWRITE) {
            LOG.info(
                    "Skip uploading artifact '{}', as it already exists."
                            + " To overwrite existing artifacts, please set the '{}' config option.",
                    target,
                    KubernetesConfigOptions.LOCAL_UPLOAD_OVERWRITE.key());
        } else {
            final long start = System.currentTimeMillis();
            final FileSystem fs = target.getFileSystem();
            try (FSDataOutputStream os = fs.create(target, writeMode)) {
                FileUtils.copyFile(src, os);
            }
            LOG.debug(
                    "Copied file from {} to {}, cost {} ms",
                    src,
                    target,
                    System.currentTimeMillis() - start);
        }

        return target.toString();
    }
@Test
    void testRemoteUri() throws Exception {
        config.removeConfig(KubernetesConfigOptions.LOCAL_UPLOAD_TARGET);
        String remoteUri = "s3://my-bucket/my-artifact.jar";

        String finalUri = artifactUploader.upload(config, remoteUri);

        assertThat(finalUri).isEqualTo(remoteUri);
    }