示例#1
0
 private async Task CreateBindMount(string sourcePath, string targetPath)
 {
     using (_metricsLogger.LatencyEvent(MetricEventNames.LinuxContainerSpecializationBindMount))
     {
         await _meshServiceClient.CreateBindMount(sourcePath, targetPath);
     }
 }
        public async Task CreatesBindMount()
        {
            _handlerMock.Protected().Setup <Task <HttpResponseMessage> >("SendAsync",
                                                                         ItExpr.IsAny <HttpRequestMessage>(),
                                                                         ItExpr.IsAny <CancellationToken>()).ReturnsAsync(new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK
            });

            const string sourcePath = EnvironmentSettingNames.DefaultLocalSitePackagesPath;
            const string targetPath = "/home/site/wwwroot";
            await _meshServiceClient.CreateBindMount(sourcePath, targetPath);

            await Task.Delay(500);

            _handlerMock.Protected().Verify <Task <HttpResponseMessage> >("SendAsync", Times.Once(),
                                                                          ItExpr.Is <HttpRequestMessage>(r => IsCreateBindMountRequest(r, sourcePath, targetPath)),
                                                                          ItExpr.IsAny <CancellationToken>());
        }