Example #1
0
        public void Unavailable()
        {
            var result = PushFileResult.ServerUnavailable();

            result.Succeeded.Should().BeFalse();

            result.ToString().Should().Contain("Unavailable");
        }
Example #2
0
        public void Unavailable_Success_Is_Succeeded()
        {
            var ringCopyResult        = PushFileResult.ServerUnavailable();
            var outsideRingCopyResult = PushFileResult.PushSucceeded();
            var result = new ProactiveCopyResult(ringCopyResult, outsideRingCopyResult, retries: 0);

            result.Succeeded.Should().BeTrue();
            ringCopyResult.Succeeded.Should().BeFalse();
            outsideRingCopyResult.Succeeded.Should().BeTrue();
            result.ToString().Should().Contain("Success");
            result.ToString().Should().Contain("Unavailable");
        }
Example #3
0
        public void Unavailable_Error_Is_Error()
        {
            var ringCopyResult        = PushFileResult.ServerUnavailable();
            var error                 = "my error";
            var outsideRingCopyResult = new PushFileResult(error);
            var result                = new ProactiveCopyResult(ringCopyResult, outsideRingCopyResult, retries: 0);

            result.Succeeded.Should().BeFalse();
            result.Status.Should().Be(ProactiveCopyStatus.Error);

            result.ToString().Should().Contain(ringCopyResult.Status.ToString());
            result.ToString().Should().Contain(outsideRingCopyResult.Status.ToString());
        }
Example #4
0
        public Task ProactiveCopyInsideRingRetriesTest()
        {
            EnableProactiveCopy            = true;
            ProactiveCopyMode              = ProactiveCopyMode.InsideRing; // Disable outside-ring proactive copies.
            ProactiveCopyOnPuts            = true;
            ProactiveCopyOnPins            = true;
            ProactiveCopyLocationThreshold = 4; // Large enough that we 'always' try to push.
            ProactiveCopyRetries           = 2;

            var contentHashes = new List <ContentHash>();

            int machineCount = 3;

            ConfigureWithOneMaster();

            var buildId = Guid.NewGuid().ToString();

            return(RunTestAsync(
                       machineCount,
                       async context =>
            {
                var masterStore = context.GetMaster();
                var defaultFileSize = (Config.MaxSizeQuota.Hard / 4) + 1;

                var sessions = context.GetDistributedSessions();

                // Insert random file #1 into worker #1
                var putResult = await sessions[0].PutRandomAsync(context, HashType.Vso0, false, defaultFileSize, Token).ShouldBeSuccess();
                var hash = putResult.ContentHash;

                var getBulkResult = await masterStore.GetBulkAsync(context, hash, GetBulkOrigin.Global).ShouldBeSuccess();

                // Proactive copy should have replicated the content.
                getBulkResult.ContentHashesInfo[0].Locations.Count.Should().Be(2);

                var counters = sessions[0].GetCounters().ToDictionaryIntegral();
                counters["ProactiveCopyInsideRingRetries.Count"].Should().Be(ProactiveCopyRetries);
                counters["ProactiveCopyRetries.Count"].Should().Be(ProactiveCopyRetries);
            },
                       implicitPin: ImplicitPin.None,
                       buildId: buildId,
                       testCopier: new ErrorReturningTestFileCopier(errorsToReturn: ProactiveCopyRetries, failingResult: PushFileResult.ServerUnavailable())));
        }
Example #5
0
        public Task ProactiveCopyRetryTest()
        {
            EnableProactiveCopy  = true;
            ProactiveCopyRetries = 2;

            var contentHashes = new List <ContentHash>();

            int machineCount = 2;

            ConfigureWithOneMaster();

            return(RunTestAsync(
                       machineCount,
                       async context =>
            {
                var masterStore = context.GetMaster();
                var defaultFileSize = (Config.MaxSizeQuota.Hard / 4) + 1;

                var sessions = context.EnumerateWorkersIndices().Select(i => context.GetDistributedSession(i)).ToArray();

                // Insert random file #1 into worker #1
                var putResult1 = await sessions[0].PutRandomAsync(context, HashType.Vso0, false, defaultFileSize, Token).ShouldBeSuccess();
                var hash1 = putResult1.ContentHash;

                var getBulkResult1 = await masterStore.GetBulkAsync(context, hash1, GetBulkOrigin.Global).ShouldBeSuccess();

                // Proactive copy should have replicated the content.
                getBulkResult1.ContentHashesInfo[0].Locations.Count.Should().Be(2);

                var counters = sessions[0].GetCounters().ToDictionaryIntegral();
                counters["ProactiveCopyRetries.Count"].Should().Be(ProactiveCopyRetries);
                counters["ProactiveCopyOutsideRingRetries.Count"].Should().Be(ProactiveCopyRetries);
            },
                       testCopier: new ErrorReturningTestFileCopier(errorsToReturn: ProactiveCopyRetries, failingResult: PushFileResult.ServerUnavailable()),
                       implicitPin: ImplicitPin.None));
        }