Example #1
0
        public MeshServiceClientTests()
        {
            var environmentVariables = new Dictionary <string, string>
            {
                [Constants.ContainerName] = "container-name",
                [Constants.MeshInitURI]   = MeshInitUri
            };

            var systemEnvironment = new TestSystemEnvironment(environmentVariables);

            _handlerMock       = new Mock <HttpMessageHandler>(MockBehavior.Strict);
            _meshServiceClient = new MeshServiceClient(systemEnvironment, new HttpClient(_handlerMock.Object));
        }
Example #2
0
        public void ReturnsApplicationName()
        {
            var          testSystemEnvironment = new TestSystemEnvironment();
            const string placeholderSiteName   = "placeholder-site-name";

            testSystemEnvironment.SetEnvironmentVariable(Constants.ContainerName, "c1"); // linux consumption
            testSystemEnvironment.SetEnvironmentVariable(Constants.WebsiteSiteName, placeholderSiteName);
            var serverConfiguration = new ServerConfiguration(testSystemEnvironment);

            Assert.Equal(placeholderSiteName, serverConfiguration.ApplicationName);

            // Updating the env variable should reflect immediately. since sitename is not cached
            const string testSite2 = "test-site-2";

            testSystemEnvironment.SetEnvironmentVariable(Constants.WebsiteSiteName, testSite2);
            Assert.Equal(testSite2, serverConfiguration.ApplicationName);
        }
        public MeshPersistentFileSystemTests()
        {
            var environmentVariables = new Dictionary <string, string>();

            environmentVariables[Constants.ContainerName]           = "container-name";
            environmentVariables[Constants.EnablePersistentStorage] = "1";
            environmentVariables[Constants.AzureWebJobsStorage]     = ConnectionString;

            _systemEnvironment = new TestSystemEnvironment(environmentVariables);

            _client        = new Mock <IMeshServiceClient>(MockBehavior.Strict);
            _storageClient = new Mock <IStorageClient>(MockBehavior.Strict);

            _storageClient.Setup(s => s.CreateFileShare(It.IsAny <string>(), ConnectionString, It.IsAny <string>()))
            .Returns(Task.CompletedTask);
            _client.Setup(c => c.MountCifs(ConnectionString, It.IsAny <string>(), Constants.KuduFileShareMountPath))
            .Returns(Task.CompletedTask);
        }