Esempio n. 1
0
        public async Task PriorityQueueModuleToHubMessages()
        {
            // TODO: Add Windows and ARM32. Windows won't be able to work for this test until we add NetworkController Windows implementation
            if (OsPlatform.IsWindows() || !OsPlatform.Is64Bit())
            {
                Assert.Ignore("Priority Queue module to module messages test has been disabled for Windows and Arm32 until we can fix it.");
            }

            CancellationToken token                  = this.TestToken;
            string            trcImage               = Context.Current.TestResultCoordinatorImage.Expect(() => new ArgumentException("testResultCoordinatorImage parameter is required for Priority Queues test"));
            string            loadGenImage           = Context.Current.LoadGenImage.Expect(() => new ArgumentException("loadGenImage parameter is required for Priority Queues test"));
            string            relayerImage           = Context.Current.RelayerImage.Expect(() => new ArgumentException("relayerImage parameter is required for Priority Queues test"));
            string            networkControllerImage = Context.Current.NetworkControllerImage.Expect(() => new ArgumentException("networkControllerImage parameter is required for Priority Queues test"));
            string            trackingId             = Guid.NewGuid().ToString();
            TestInfo          testInfo               = this.InitTestInfo(5, 1000, true);

            var testResultReportingClient = new TestResultReportingClient {
                BaseUrl = "http://localhost:5001"
            };

            Action <EdgeConfigBuilder> addInitialConfig           = this.BuildAddInitialConfig(trackingId, "hubtest", trcImage, loadGenImage, testInfo, true);
            Action <EdgeConfigBuilder> addNetworkControllerConfig = this.BuildAddNetworkControllerConfig(trackingId, networkControllerImage);
            EdgeDeployment             deployment = await this.runtime.DeployConfigurationAsync(addInitialConfig + addNetworkControllerConfig, token);

            bool networkOn = true;

            await this.ToggleConnectivity(!networkOn, NetworkControllerModuleName, token);

            await Task.Delay(TimeSpan.Parse(LoadGenTestDuration) + TimeSpan.Parse(LoadGenTestStartDelay) + TimeSpan.FromSeconds(10));

            await this.ToggleConnectivity(networkOn, NetworkControllerModuleName, token);

            PriorityQueueTestStatus loadGenTestStatus = await this.PollUntilFinishedAsync(LoadGenModuleName, token);

            ConcurrentQueue <MessageTestResult> messages = new ConcurrentQueue <MessageTestResult>();

            await this.ReceiveEventsFromIotHub(deployment.StartTime, messages, loadGenTestStatus, token);

            while (messages.TryDequeue(out MessageTestResult messageTestResult))
            {
                await testResultReportingClient.ReportResultAsync(messageTestResult.ToTestOperationResultDto());
            }

            await this.ValidateResultsAsync();
        }
Esempio n. 2
0
        public async Task PriorityQueueModuleToHubMessages()
        {
            CancellationToken token                  = this.TestToken;
            string            trcImage               = Context.Current.TestResultCoordinatorImage.Expect(() => new ArgumentException("testResultCoordinatorImage parameter is required for Priority Queues test"));
            string            loadGenImage           = Context.Current.LoadGenImage.Expect(() => new ArgumentException("loadGenImage parameter is required for Priority Queues test"));
            string            relayerImage           = Context.Current.RelayerImage.Expect(() => new ArgumentException("relayerImage parameter is required for Priority Queues test"));
            string            networkControllerImage = Context.Current.NetworkControllerImage.Expect(() => new ArgumentException("networkControllerImage parameter is required for Priority Queues test"));
            string            trackingId             = Guid.NewGuid().ToString();
            TestInfo          testInfo               = this.InitTestInfo(5, 1000, true, "00:00:40");

            var testResultReportingClient = new TestResultReportingClient {
                BaseUrl = "http://localhost:5001"
            };

            Action <EdgeConfigBuilder> addLoadGenConfig           = this.BuildAddLoadGenConfig(trackingId, loadGenImage, testInfo, true);
            Action <EdgeConfigBuilder> addTrcConfig               = TestResultCoordinatorUtil.BuildAddTestResultCoordinatorConfig(trackingId, trcImage, LoadGenModuleName, "hubtest");
            Action <EdgeConfigBuilder> addNetworkControllerConfig = TestResultCoordinatorUtil.BuildAddNetworkControllerConfig(trackingId, networkControllerImage);

            EdgeDeployment deployment = await this.runtime.DeployConfigurationAsync(addLoadGenConfig + addTrcConfig + addNetworkControllerConfig, token, Context.Current.NestedEdge);

            bool networkOn = true;

            await this.ToggleConnectivity(!networkOn, NetworkControllerModuleName, token);

            await Task.Delay(TimeSpan.Parse(LoadGenTestDuration) + TimeSpan.Parse(testInfo.LoadGenStartDelay) + TimeSpan.FromSeconds(10));

            await this.ToggleConnectivity(networkOn, NetworkControllerModuleName, token);

            PriorityQueueTestStatus loadGenTestStatus = await this.PollUntilFinishedAsync(LoadGenModuleName, token);

            ConcurrentQueue <MessageTestResult> messages = new ConcurrentQueue <MessageTestResult>();

            await this.ReceiveEventsFromIotHub(deployment.StartTime, messages, loadGenTestStatus, trackingId, token);

            while (messages.TryDequeue(out MessageTestResult messageTestResult))
            {
                await testResultReportingClient.ReportResultAsync(messageTestResult.ToTestOperationResultDto());
            }

            await TestResultCoordinatorUtil.ValidateResultsAsync();
        }