private async Task UnpackPackage(string filePath, string scriptPath, RunFromPackageContext pkgContext) { CodePackageType packageType; using (_metricsLogger.LatencyEvent(MetricEventNames.LinuxContainerSpecializationGetPackageType)) { packageType = GetPackageType(filePath, pkgContext); } if (packageType == CodePackageType.Squashfs) { // default to mount for squashfs images if (_environment.IsMountDisabled()) { UnsquashImage(filePath, scriptPath); } else { await _meshInitServiceClient.MountFuse("squashfs", filePath, scriptPath); } } else if (packageType == CodePackageType.Zip) { // default to unzip for zip packages if (_environment.IsMountEnabled()) { await _meshInitServiceClient.MountFuse("zip", filePath, scriptPath); } else { UnzipPackage(filePath, scriptPath); } } }
public async Task MountsFuseShare() { _handlerMock.Protected().Setup <Task <HttpResponseMessage> >("SendAsync", ItExpr.IsAny <HttpRequestMessage>(), ItExpr.IsAny <CancellationToken>()).ReturnsAsync(new HttpResponseMessage { StatusCode = HttpStatusCode.OK }); const string filePath = "https://storage.blob.core.windows.net/functions/func-app.zip"; const string targetPath = "/home/site/wwwroot"; await _meshInitServiceClient.MountFuse("squashfs", filePath, targetPath); await Task.Delay(500); _handlerMock.Protected().Verify <Task <HttpResponseMessage> >("SendAsync", Times.Once(), ItExpr.Is <HttpRequestMessage>(r => IsMountFuseRequest(r, filePath, targetPath)), ItExpr.IsAny <CancellationToken>()); }