public async Task UploadModel_ShouldCreateFolderIfNotExists()
        {
            // Arrange
            var folderPath = mockFileSystem.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".mlops", "model-repository");

            mockFileSystem.AddFile("model.zip", new MockFileData("test"));

            // Act
            await sut.UploadModelAsync(new Guid(), "model.zip");

            // Assert
            mockFileSystem.Directory.Exists(folderPath).Should().Be(true);
        }
        public async Task DeployModel_GivenAnExistingModel_ShouldDeployModelToDeploymentTargetFolder()
        {
            //Arrange
            var experiment = new Experiment("ExperimentName");

            var registeredModel = new RegisteredModel
            {
                RunId        = Guid.NewGuid(),
                ExperimentId = experiment.ExperimentId,
            };

            var deploymentTarget = new DeploymentTarget("Test");

            await sut.UploadModelAsync(registeredModel.RunId, @"Data/model.txt");

            //Act
            var deployedPath = await sut.DeployModelAsync(deploymentTarget, registeredModel, experiment);

            //Assert
            File.Exists(deployedPath).Should().BeTrue();
        }
Example #3
0
        public async Task UploadModel_ShouldSaveFile()
        {
            // Arrange
            var mockFileSystem = new MockFileSystem();
            var folderPath     = mockFileSystem.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".mlops");

            mockFileSystem.AddFile("model.zip", new MockFileData("test"));
            var sut = new LocalFileModelRepository(mockFileSystem);
            var expectedFilePath = mockFileSystem.Path.Combine(folderPath, $"{new Guid()}.zip");

            // Act
            await sut.UploadModelAsync(new Guid(), "model.zip");

            // Assert
            mockFileSystem.FileExists(expectedFilePath).Should().Be(true);
        }