-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Synapse] Rework and extend unit tests #18010
Conversation
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.
LGTM, though you may want to get another pair of eyes more familiar with the recorded test infrastructure to take a peek.
)); | ||
} | ||
|
||
[Ignore("This test case cannot be automated due to the inability to configure infrastructure to test against.")] |
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.
There's a test category "Manually" that seems to be the recommended approach for these types. Tests with that category are not run automatically by the pipelines.
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.
I believe most of these could be automated, I don't want to give up yet. Filing an issue and using it to track.
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.
|
||
DataFlowCreateOrUpdateDataFlowOperation createOperation = await DataFlowClient.StartCreateOrUpdateDataFlowAsync(dataFlowName, new DataFlowResource(new DataFlow())); | ||
await createOperation.WaitForCompletionAsync(); | ||
// Non-disposable as we'll be deleting it ourselves |
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.
I'm not sure what this comments means. I think you're saying "This resource is disposable but we're not going to dispose it so that we can control deletion." - am I close?
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.
It was "we're getting the raw resource and not using the Disposable for a reason here. If that wasn't clear, maybe I should just nuke the comment.
sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/DisposableDataFlow.cs
Outdated
Show resolved
Hide resolved
[Test] | ||
public async Task TestGetLinkedService() | ||
{ | ||
await foreach (var expectedLinkedService in LinkedServiceClient.GetLinkedServicesByWorkspaceAsync()) | ||
LinkedServiceClient client = CreateClient (); |
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.
nit: Extra space before parenthesis.
sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/LinkedServiceClientLiveTests.cs
Outdated
Show resolved
Hide resolved
sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/SqlScriptClientLiveTests.cs
Show resolved
Hide resolved
sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/TriggerRunClientLiveTests.cs
Show resolved
Hide resolved
/// <typeparam name="T">The item type.</typeparam> | ||
/// <param name="items">The sequence of items.</param> | ||
/// <returns>A list of all the items in the sequence.</returns> | ||
public static async Task<IList<T>> ToListAsync<T>(this IAsyncEnumerable<T> items) |
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.
I think there may be something in the test framework that does this....
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.
I found a few copies, but none in a common location:
PS C:\Users\chhamo\Programming\azure-sdk-for-net\sdk> git grep ToListAsync | Select-String Task
batch/Microsoft.Azure.Batch.FileStaging/tests/FileStagingIntegrationTests.cs: List<CloudTask> tasksFromService = await
jobOperations.ListTasks(jobId).ToListAsync().ConfigureAwait(false);
batch/Microsoft.Azure.Batch/src/PagedEnumerableExtensions.cs: public static async Task<List<T>> ToListAsync<T>(this IPagedEnumerable<T> source,
CancellationToken cancellationToken = default(CancellationToken))
batch/Microsoft.Azure.Batch/tests/IntegrationTests/AddTaskCollectionIntegrationTests.cs: List<CloudTask> tasksFromService = await
jobOperations.ListTasks(jobId).ToListAsync().ConfigureAwait(false);
batch/Microsoft.Azure.Batch/tests/UnitTests/PagedCollectionUnitTests.cs: public async Task IfSequenceIsNull_ThenToListAsyncThrowsArgumentNullException()
batch/Microsoft.Azure.Batch/tests/UnitTests/PagedCollectionUnitTests.cs: public async Task ToListAsyncCollectsAllElementsOfSequence()
batch/Microsoft.Azure.Batch/tests/UnitTests/PagedCollectionUnitTests.cs: public async Task ToListAsyncCorrectlyHandlesEmptyCollections()
batch/Microsoft.Azure.Batch/tests/UnitTests/PagedCollectionUnitTests.cs: public async Task ToListAsyncSupportsCancellation()
search/Azure.Search.Documents/tests/Utilities/TestExtensions.cs: public static async Task<List<T>> ToListAsync<T>(this AsyncPageable<T> pageable)
storage/Azure.Storage.Common/tests/Shared/TestExtensions.cs: public static async Task<IList<T>> ToListAsync<T>(this IAsyncEnumerable<T> items)
synapse/Azure.Analytics.Synapse.Shared/tests/SynapseTestExtensions.cs: public static async Task<IList<T>> ToListAsync<T>(this IAsyncEnumerable<T> items)
ValidateSparkBatchJob(expectedSparkJob, actualSparkJob); | ||
} | ||
catch (Azure.RequestFailedException) | ||
{ | ||
} | ||
} | ||
} | ||
|
||
internal void ValidateSparkBatchJob(SparkBatchJob expectedSparkJob, SparkBatchJob actualSparkJob) |
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.
string name = test.Recording.GenerateName("dontnetbatch"); | ||
string file = string.Format("abfss://{0}@{1}.dfs.core.windows.net/samples/java/wordcount/wordcount.jar", test.TestEnvironment.StorageFileSystemName, test.TestEnvironment.StorageAccountName); | ||
string name = recording.GenerateName("dontnetbatch"); | ||
string file = string.Format("abfss://{0}@{1}.dfs.core.windows.net/samples/java/wordcount/wordcount.jar", testEnvironment.StorageFileSystemName, testEnvironment.StorageAccountName); |
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.
Does it matter that these are referring to java
. Is this URI stable across environments/platforms/clouds?
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.
These tests require the uploaded sample from the team copied onto the shared storage, which can be either java, python, or dotnet.
This code in question was from the client team, and defaulted to java. I'm planning on improving this in a future PR.
sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/DataFlowDebugSessionClientLiveTests.cs
Outdated
Show resolved
Hide resolved
sdk/synapse/Azure.Analytics.Synapse.Shared/tests/SynapseTestExtensions.cs
Outdated
Show resolved
Hide resolved
Changing the ID generation invalidated all of the recordings. Fixing. |
This is the first in a set of PRs intended to complete a basic level of test coverage on Synapse. This one in particular is more extension, and less additive, as it refactors and restructures the existing tests. Some notes: - I've removed the shared testing base class, and moved some test helpers into static methods that declare the needed resources instead of digging into the base class's public variables. I also explicitly instance the test class in each test. - I prefer less magic and more explicit behavior as a rule. I find this easier to maintain. - I also updated test and sample namespaces to match the guidance from the template Foo.Bar.Tests or Foo.Bar.Samples - A few new tests are included, just to prevent code coverage regressions. Some of them are [Ignored] due to current limitations in the test-resources.json instance, or issues with the service/SDK that I'm looking at. - I am aware that some of the tests I fixed up in the refactor don't assert much, or could be improved further. As I noted above, additional test work will continue after this. - I added a bunch of "stub" test classes just to fill out the set of test files, and to make it explicit what isn't being tested yet.
This is the first in a set of PRs intended to complete a basic level of test coverage on Synapse. This one in particular is more extension, and less additive, as it refactors and restructures the existing tests.
Some notes: