-
Notifications
You must be signed in to change notification settings - Fork 44
Users/ramacg/refactor managed uploader #455
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
base: feature/IngestV2
Are you sure you want to change the base?
Changes from all commits
bc71e38
29def52
11d42f6
23580f1
32008a6
da72756
a51c91a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,95 @@ | ||||||||||||
| // Copyright (c) Microsoft Corporation. | ||||||||||||
| // Licensed under the MIT License. | ||||||||||||
| package com.microsoft.azure.kusto.ingest.v2.uploader | ||||||||||||
|
|
||||||||||||
| import com.microsoft.azure.kusto.ingest.v2.common.ConfigurationCache | ||||||||||||
| import com.microsoft.azure.kusto.ingest.v2.common.serialization.OffsetDateTimeSerializer | ||||||||||||
| import com.microsoft.azure.kusto.ingest.v2.models.ConfigurationResponse | ||||||||||||
| import kotlinx.coroutines.Dispatchers | ||||||||||||
| import kotlinx.coroutines.runBlocking | ||||||||||||
| import kotlinx.coroutines.withContext | ||||||||||||
| import kotlinx.serialization.json.Json | ||||||||||||
| import kotlinx.serialization.modules.SerializersModule | ||||||||||||
| import org.junit.jupiter.api.Assertions.assertFalse | ||||||||||||
| import org.junit.jupiter.api.Assertions.assertNotNull | ||||||||||||
| import org.junit.jupiter.api.Assertions.assertTrue | ||||||||||||
| import org.junit.jupiter.params.ParameterizedTest | ||||||||||||
| import org.junit.jupiter.params.provider.CsvSource | ||||||||||||
| import java.nio.charset.StandardCharsets | ||||||||||||
| import java.nio.file.Files | ||||||||||||
| import java.nio.file.Paths | ||||||||||||
| import java.time.Duration | ||||||||||||
| import java.time.OffsetDateTime | ||||||||||||
|
|
||||||||||||
| class ManagedUploaderTest { | ||||||||||||
|
|
||||||||||||
| @ParameterizedTest(name = "PreferredUploadMethod={0}") | ||||||||||||
| @CsvSource("DEFAULT", "STORAGE", "LAKE") | ||||||||||||
| fun selectContainers(preferredUploadMethod: String): Unit = runBlocking { | ||||||||||||
| val uploadMethod = UploadMethod.valueOf(preferredUploadMethod) | ||||||||||||
| val configurationCache = TestConfigurationCache() | ||||||||||||
| val managedUploader = | ||||||||||||
| ManagedUploaderBuilder.create() | ||||||||||||
| .withConfigurationCache(configurationCache) | ||||||||||||
| .build() | ||||||||||||
| val selectedContainers = managedUploader.selectContainers(uploadMethod) | ||||||||||||
| assertNotNull(selectedContainers) | ||||||||||||
| assertTrue(selectedContainers.isNotEmpty()) | ||||||||||||
| selectedContainers.forEach { | ||||||||||||
| assertNotNull(it.containerInfo.path) | ||||||||||||
| // If we get both lake and storage and user does not specify, lake is preferred. If user | ||||||||||||
| // specifies, respect that. | ||||||||||||
|
Comment on lines
+40
to
+41
|
||||||||||||
| // If we get both lake and storage and user does not specify, lake is preferred. If user | |
| // specifies, respect that. | |
| // When the server configuration prefers Lake and the user does not specify (DEFAULT), | |
| // ManagedUploader should honor the server preference and use Lake. If the user explicitly | |
| // specifies a method (e.g., STORAGE), that explicit choice is respected. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "containerSettings": { | ||
| "containers": [ | ||
| { | ||
| "path": "https://somecontainer.z11.blob.storage.azure.net/trdwvweg9nfnngghb1eey-20260108-ingestdata-e5c334ee145d4b4-0?sv=keys" | ||
| } | ||
| ], | ||
| "lakeFolders": [ | ||
| { | ||
| "path": "https://alakefolder.onelake.fabric.microsoft.com/17a97d10-a17f-4d72-8f38-858aac992978/bb9c26d4-4f99-44b5-9614-3ebb037f3510/Ingestions/20260108-lakedata" | ||
| } | ||
| ], | ||
| "refreshInterval": "01:00:00", | ||
| "preferredUploadMethod": "Lake" | ||
| }, | ||
| "ingestionSettings": { | ||
| "maxBlobsPerBatch": 20, | ||
| "maxDataSize": 6442450944, | ||
| "preferredIngestionMethod": "Rest" | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The refresh interval parsing uses LocalTime.parse() which expects a time format (HH:mm:ss), but the actual format in the config is a TimeSpan/Duration string ("01:00:00"). While "01:00:00" may parse as LocalTime, this is semantically incorrect - you're parsing a duration as a time-of-day. Consider using Duration.parse() with the ISO-8601 duration format (e.g., "PT1H") or implement proper TimeSpan parsing that handles the format correctly.