|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.IO; |
| 4 | +using System.Linq; |
| 5 | +using System.Text; |
| 6 | +using System.Threading.Tasks; |
| 7 | +using Azure.Sdk.Tools.TestProxy.Common; |
| 8 | +using Azure.Sdk.Tools.TestProxy.Store; |
| 9 | +using Microsoft.Extensions.Logging; |
| 10 | +using Xunit; |
| 11 | + |
| 12 | +namespace Azure.Sdk.Tools.TestProxy.Tests |
| 13 | +{ |
| 14 | + // Test Scenarios involving https://github.com/Azure/azure-sdk-assets-integration |
| 15 | + // Current state: |
| 16 | + // Outside of the common files in the root, the only recordings in the repository |
| 17 | + // are at https://github.com/Azure/azure-sdk-assets-integration/tree/main/python/recordings/sdk/tables/azure-data-tables/tests/recordings |
| 18 | + // and for those there's only a single set of 3 recording files with no history. |
| 19 | + |
| 20 | + // Additional Setup: |
| 21 | + // We're going to want to push another commit that adds a couple of new recordings and changes |
| 22 | + public class GitStoreIntegrationTests |
| 23 | + { |
| 24 | + public GitStoreIntegrationTests() |
| 25 | + { |
| 26 | + var loggerFactory = new LoggerFactory(); |
| 27 | + DebugLogger.ConfigureLogger(loggerFactory); |
| 28 | + } |
| 29 | + |
| 30 | + private GitStore _defaultStore = new GitStore(); |
| 31 | + |
| 32 | + [Theory] |
| 33 | + [InlineData( |
| 34 | + @"{ |
| 35 | + ""AssetsRepo"": ""Azure/azure-sdk-assets-integration"", |
| 36 | + ""AssetsRepoPrefixPath"": ""python/recordings/"", |
| 37 | + ""AssetsRepoId"": """", |
| 38 | + ""AssetsRepoBranch"": ""auto/test"", |
| 39 | + ""SHA"": ""786b4f3d380d9c36c91f5f146ce4a7661ffee3b9"" |
| 40 | + }")] |
| 41 | + public async Task TestBasicRestoreFromAssetsJson(string inputJson) |
| 42 | + { |
| 43 | + string[] folderStructure = new string[] |
| 44 | + { |
| 45 | + GitStoretests.AssetsJson |
| 46 | + }; |
| 47 | + |
| 48 | + var testFolder = TestHelpers.DescribeTestFolder(inputJson, folderStructure); |
| 49 | + var jsonFileLocation = Path.Join(testFolder, GitStoretests.AssetsJson); |
| 50 | + |
| 51 | + var parsedConfiguration = await _defaultStore.ParseConfigurationFile(jsonFileLocation); |
| 52 | + await _defaultStore.Restore(jsonFileLocation); |
| 53 | + } |
| 54 | + } |
| 55 | +} |
0 commit comments