Esempio n. 1
0
        public async Task Start_With_Server_And_AvailableService()
        {
            var host = TestsHelper.CreateTestHostWithServer();

            TestsHelper.CleanupFolders(host);
            TestsHelper.PublishDemoProject(host);
            var starter = host.Services.GetRequiredService <Palace.Services.IStarter>();

            await starter.Start();

            starter.InstanciedServiceCount.Should().Be(1);

            await starter.Stop();

            starter.InstanciedServiceCount.Should().Be(0);
        }
Esempio n. 2
0
        public async Task Start_With_Crashed_MicroService()
        {
            var host = TestsHelper.CreateTestHostWithServer();

            TestsHelper.CleanupFolders(host);

            var settings = host.Services.GetRequiredService <Palace.Configuration.PalaceSettings>();

            var starter = host.Services.GetRequiredService <Palace.Services.IStarter>();

            var msm = host.Services.GetRequiredService <Palace.Services.MicroServicesCollectionManager>();
            await msm.SynchronizeConfiguration(true);

            await msm.AddOrUpdateService(new Models.MicroServiceSettings
            {
                PackageFileName = "DemoSvc.zip",
                ServiceName     = "DemoSvc3",
                MainAssembly    = "DemoSvc.dll",
                Arguments       = "--port 12348 --crash true",
                AdminServiceUrl = "http://localhost:12348",
                PalaceApiKey    = "test"
            });

            TestsHelper.PublishDemoProject(host);

            await starter.Start();

            await starter.CheckHealth();

            var svc = starter.GetMicroServiceInfo("DemoSvc4");

            svc.Should().BeNull();

            var svcSettings = starter.GetMicroServiceSettings("DemoSvc4");

            svcSettings.Should().NotBeNull();

            starter.InstanciedServiceCount.Should().Be(0);
            starter.RunningServiceCount.Should().Be(0);

            await starter.Stop();

            starter.InstanciedServiceCount.Should().Be(0);
        }
Esempio n. 3
0
        public async Task Start()
        {
            var host = TestsHelper.CreateTestHostWithServer();

            TestsHelper.CleanupFolders(host);

            var starter = host.Services.GetRequiredService <Palace.Services.IStarter>();

            await starter.Start();

            starter.InstanciedServiceCount.Should().Be(0);

            await starter.CheckHealth();

            starter.InstanciedServiceCount.Should().Be(0);

            var msm = host.Services.GetRequiredService <Palace.Services.MicroServicesCollectionManager>();
            await msm.SynchronizeConfiguration(true);

            await msm.AddOrUpdateService(new Models.MicroServiceSettings
            {
                PackageFileName = "DemoSvc.zip",
                ServiceName     = "DemoSvc",
                MainAssembly    = "DemoSvc.dll",
                Arguments       = "--port 12346",
                AdminServiceUrl = "http://localhost:12346",
                PalaceApiKey    = "test"
            });

            await starter.CheckUpdate();

            starter.InstanciedServiceCount.Should().Be(1);
            starter.RunningServiceCount.Should().Be(0);

            await starter.Stop();

            starter.InstanciedServiceCount.Should().Be(0);
        }