Example #1
0
 public static void Init(TestContext ctx)
 {
     // We need to create the container & associated policies
     _ctx = InitializeConfigAndCreateTestBlobs(ctx, "datax1", new Dictionary<string, string>
         {
             { "AccountName", "dashstorage1" },
             { "AccountKey", "8jqRVtXUWiEthgIhR+dFwrB8gh3lFuquvJQ1v4eabObIj7okI1cZIuzY8zZHmEdpcC0f+XlUkbFwAhjTfyrLIg==" },
             { "SecondaryAccountKey", "Klari9ZbVdFQ35aULCfqqehCsd136amhusMHWynTpz2Pg+GyQMJw3GH177hvEQbaZ2oeRYk3jw0mIaV3ehNIRg==" },
         },
         new TestBlob[] { });
     // Create required stored access policies
     var body = new XDocument(
         new XElement("SignedIdentifiers",
             new XElement("SignedIdentifier",
                 new XElement("Id", StoredPolicyTest),
                 new XElement("AccessPolicy",
                     new XElement("Start", DateTimeOffset.UtcNow.ToString()),
                     new XElement("Expiry", DateTimeOffset.UtcNow.AddMinutes(30).ToString()),
                     new XElement("Permission", "r"))),
             new XElement("SignedIdentifier",
                 new XElement("Id", StoredPolicyNoDates),
                 new XElement("AccessPolicy",
                     new XElement("Permission", "r")))));
     _ctx.Runner.ExecuteRequest(_ctx.GetContainerUri() + "&comp=acl", "PUT", body, HttpStatusCode.OK);
 }
Example #2
0
 public static void Init(TestContext ctx)
 {
     _ctx = InitializeConfig(ctx, "dataimportx2", new Dictionary<string, string>
     {
         { "AccountName", "dashtest" },
     });
 }
Example #3
0
 public static void Init(TestContext ctx)
 {
     _ctx = InitializeConfigAndCreateTestBlobs(ctx, "datax2", new Dictionary<string, string>(), 
         new[] {
             TestBlob.DefineBlob("test.txt"),
             TestBlob.DefineBlob("pagetest.txt", blobType: BlobType.PageBlob),
         });
 }
Example #4
0
 public static void Init(TestContext ctx)
 {
     _ctx = InitializeConfig(ctx, "datax2", new Dictionary<string, string>
         {
             { "AccountName", "dashtest" },
         });
     _queue = new AzureMessageQueue(null, Guid.NewGuid().ToString());
 }
Example #5
0
 public static void Init(TestContext ctx)
 {
     _ctx = InitializeConfigAndCreateTestBlobs(ctx, "datax3", new Dictionary<string, string>
         {
             { DashConfiguration.KeyWorkerQueueName, Guid.NewGuid().ToString() },
             { "ReplicationMetadataName", ReplicateMetadataName },
             { "ReplicationPathPattern", "^.*/test22(/.*|$)" },
             { "LogNormalOperations", "true" }
         },
         new[] {
             TestBlob.DefineBlob("fixed-test.txt"),
         });
 }
Example #6
0
 static public void Init(TestContext ctx)
 {
     _ctx = InitializeConfigAndCreateTestBlobs(ctx, "constantx2", new Dictionary<string, string>
         {
             { DashConfiguration.KeyWorkerQueueName, Guid.NewGuid().ToString() },
             { "ReplicationMetadataName", ReplicateMetadataName },
             { "LogNormalOperations", "true" }
         },
         new[] {
             TestBlob.DefineBlob(".gitignore", copyDestination: "copyfolder/.gitignore"),
             TestBlob.DefineBlob("Dpe Ted-Landcestry Application-O365 Azure-AAD Gateway-Gateway Development -- DLan-Gsx Ring-Movies-Graph API Test-6-26-2014-credentials.publishsettings"),
             TestBlob.DefineBlob("ctestblob.txt"),
             TestBlob.DefineBlob("dtestblob.txt"),
             TestBlob.DefineBlob("etestblob.txt"),
             TestBlob.DefineBlob("ftestblob.txt"),
             TestBlob.DefineBlob("gtestblob.txt"),
             TestBlob.DefineBlob("htestblob.txt"),
             TestBlob.DefineBlob("itestblob.txt"),
             TestBlob.DefineBlob("jtestblob.txt"),
             TestBlob.DefineBlob("ktestblob.txt"),
             TestBlob.DefineBlob("ltestblob.txt"),
             TestBlob.DefineBlob("mtestblob.txt"),
             TestBlob.DefineBlob("ntestblob.txt"),
             TestBlob.DefineBlob("otestblob.txt"),
             TestBlob.DefineBlob("ptestblob.txt", blobType: BlobType.PageBlob),
             TestBlob.DefineBlob("qtestblob.txt"),
             TestBlob.DefineBlob("rtestblob.txt"),
             TestBlob.DefineBlob("stestblob.txt"),
             TestBlob.DefineBlob("ttestblob.txt"),
             TestBlob.DefineBlob("utestblob.txt"),
             TestBlob.DefineBlob("vtestblob.txt"),
             TestBlob.DefineBlob("wtestblob.txt"),
             // Folder structure
             TestBlob.DefineBlob("bfolder/testfolderblob.txt"),
             TestBlob.DefineBlob("gfolder/testfolderblob01.txt"),
             TestBlob.DefineBlob("gfolder/testfolderblob02.txt"),
             TestBlob.DefineBlob("gfolder/testfolderblob03.txt", isReplicated: true),
             TestBlob.DefineBlob("mfolder/subfolder1/testfolderblob.txt"),
             TestBlob.DefineBlob("mfolder/subfolder2/testfolderblob01.txt"),
             TestBlob.DefineBlob("mfolder/subfolder2/testfolderblob02.txt"),
             // Snapshots
             TestBlob.DefineBlob("snapshotblob.txt", numSnapshots: 2),
             // Replicas
             TestBlob.DefineBlob("creplicatedblob.txt", isReplicated: true),
         }.Concat(Enumerable.Range(0, 20)
             .Select(index => TestBlob.DefineBlob(String.Format("deleteblob{0:000}.txt", index)))));
     for (int index = 0; index < 20; index++)
     {
         _ctx.Runner.ExecuteRequest(_ctx.GetBlobUri(String.Format("deleteblob{0:000}.txt", index)), "DELETE");
     }
 }
Example #7
0
 public static void Init(TestContext ctx)
 {
     _ctx = InitializeConfigAndCreateTestBlobs(ctx, "datax2", new Dictionary<string, string>
         {
             { "AccountName", "dashtest" },
         },
         new[] {
             TestBlob.DefineBlob("fixed-test.txt"),
             TestBlob.DefineBlob("test.txt"),
             TestBlob.DefineBlob("test_in_different_data_account.txt"),
             TestBlob.DefineBlob("encoded%2d1.txt"),
             TestBlob.DefineBlob("1"),
         });
 }
Example #8
0
 public static void Init(TestContext ctx)
 {
     _containerPrefix = Guid.NewGuid().ToString().Substring(0, 8);
     _ctx = InitializeConfigAndCreateTestBlobs(ctx, "datax2", new Dictionary<string, string>(), new TestBlob[] { }, _containerPrefix);           // We just need the container
     _ctx2 = InitializeConfigAndCreateTestBlobs(ctx, "datax2", new Dictionary<string, string>(), new TestBlob[] { }, _containerPrefix);          // We just need the container
 }
Example #9
0
 protected static void CleanupTestBlobs(DashTestContext ctx)
 {
     // Delete the container
     ctx.Runner.ExecuteRequest(ctx.GetContainerUri(), "DELETE");
     if (ctx.WorkerQueue != null)
     {
         ctx.WorkerQueue.DeleteQueue();
     }
 }
Example #10
0
        protected static void CreateTestBlobs(DashTestContext ctx, IEnumerable<TestBlob> testBlobs)
        {
            bool needAsyncRun = false;
            // Create the per-test container
            var results = ctx.Runner.ExecuteRequest(ctx.GetContainerUri(), "PUT", expectedStatusCode: HttpStatusCode.Created);
            foreach (var blobDefn in testBlobs)
            {
                HttpContent content;
                if (blobDefn.BlobType == BlobType.BlockBlob)
                {
                    content = new StringContent("hello world", System.Text.Encoding.UTF8, "text/plain");
                    content.Headers.Add("x-ms-blob-type", "BlockBlob");
                }
                else
                {
                    content = new StringContent("");
                    content.Headers.Add("x-ms-blob-type", "PageBlob");
                    content.Headers.Add("x-ms-blob-content-length", "1024");
                }
                content.Headers.Add("x-ms-version", "2013-08-15");
                if (blobDefn.IsReplicated)
                {
                    content.Headers.Add("x-ms-meta-" + ReplicateMetadataName, "true");
                    needAsyncRun = true;
                }
                // Setup correct encoding for blob names
                string blobName = ctx.GetBlobUri(PathUtils.PathEncode(blobDefn.Name));
                ctx.Runner.ExecuteRequest(blobName, "PUT", content, HttpStatusCode.Created);

                for (int snapshot = 0; snapshot < blobDefn.NumberOfSnapshots; snapshot++)
                {
                    // Pause to allow multiple snapshots to be distinguishable from one another
                    Task.Delay(1000).Wait();
                    ctx.Runner.ExecuteRequest(ctx.GetBlobUri(blobDefn.Name) + "?comp=snapshot", "PUT");
                }
                if (!String.IsNullOrWhiteSpace(blobDefn.CopyDestination))
                {
                    ctx.Runner.ExecuteRequestWithHeaders(ctx.GetBlobUri(blobDefn.CopyDestination),
                        "PUT",
                        null,
                        new[] {
                            Tuple.Create("x-ms-version", "2013-08-15"),
                            Tuple.Create("x-ms-copy-source", "http://mydashserver/" + ctx.ContainerName + "/" + blobDefn.Name),
                        },
                        HttpStatusCode.Accepted);
                }
            }
            // Allow the async stuff to run
            if (needAsyncRun)
            {
                Task.Delay(1000).Wait();
                int processed = 0, errors = 0;
                MessageProcessor.ProcessMessageLoop(ref processed, ref errors, 0);
            }
        }
Example #11
0
 public static void Init(TestContext ctx)
 {
     _ctx = InitializeConfig(ctx, "datax1", new Dictionary<string, string>());
 }