Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uninstall creatio #305

Merged
merged 11 commits into from
Jul 18, 2024
Merged
87 changes: 0 additions & 87 deletions .github/workflows/codeql.yml

This file was deleted.

13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ docker run -it --rm clio reg-web-app -help
- [Using for CI/CD systems](#using-for-cicd-systems)
- [GitOps](#gitops)
- [Installation of Creatio](#installation-of-creatio-using-clio)
--[Manage requirment Windows features](#manage-requirment-windows-features)
- [Manage required Windows features](#manage-required-windows-features)
- [Uninstall Creatio](#uninstall-creatio)

# Arguments

Expand Down Expand Up @@ -1121,7 +1122,7 @@ To create an empty cluster, we recommend using [Rancher Desktop](https://rancher

> If you already have running MSSQL/PostgresSQL/Redis servers on you local machine you have to configure kubernetes services ports to avoid collisions. Reffer to services.yaml in related directories

## Manage requirment Windows features
## Manage required Windows features

To manage required windows features execute command

Expand Down Expand Up @@ -1295,3 +1296,11 @@ You can also specify `DbName` and `BackupFilePath` properties to simplify comman
```bash
clio resrore-db -e <ENVIRONMENT_NAME>
```

## Uninstall Creatio

Uninstall Creatio from your local machine by executing the following command:

```bash
clio uninstall-creatio -e <ENV_NAME>
```
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$cliogate_Version="2.0.0.29"
$cliogate_Version="2.0.0.30"
$clioPath=".\clio\bin\Release\net6.0\clio.dll"

dotnet build .\clio\clio.csproj -c Release --no-incremental
Expand Down
16 changes: 8 additions & 8 deletions clio.tests/ApplicationInstallerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal class ApplicationInstallerTests : BaseClioModuleTests
[Test]
public void RestartApplicationAfterInstallPackageInNet6() {
string packagePath = "T:\\TestClioPackage.gz";
_fileSystem.AddFile(packagePath, new System.IO.Abstractions.TestingHelpers.MockFileData(new byte[0]));
FileSystem.AddFile(packagePath, new System.IO.Abstractions.TestingHelpers.MockFileData(new byte[0]));
EnvironmentSettings environmentSettings = new EnvironmentSettings();
environmentSettings.IsNetCore = true;
var applicationClientFactory = Substitute.For<IApplicationClientFactory>();
Expand All @@ -29,7 +29,7 @@ public void RestartApplicationAfterInstallPackageInNet6() {
var scriptExecutor = Substitute.For<ISqlScriptExecutor>();
var serviceUrlBuilder = Substitute.For<IServiceUrlBuilder>();
var logger = Substitute.For<ILogger>();
var clioFileSystem = new FileSystem(_fileSystem);
var clioFileSystem = new FileSystem(FileSystem);
ApplicationInstaller applicationInstaller = new ApplicationInstaller(environmentSettings,
applicationClientFactory,
application,
Expand All @@ -47,20 +47,20 @@ public void RestartApplicationAfterInstallPackageInNet6() {
[Test]
public void RestartApplicationAfterInstallFolderInNet6() {
string packageFolderPath = "T:\\TestClioPackageFolder";
_fileSystem.AddDirectory(packageFolderPath);
FileSystem.AddDirectory(packageFolderPath);
EnvironmentSettings environmentSettings = new EnvironmentSettings();
environmentSettings.IsNetCore = true;
var applicationClientFactory = Substitute.For<IApplicationClientFactory>();
var application = Substitute.For<IApplication>();
var packageArchiver = Substitute.For<IPackageArchiver>();
packageArchiver.When(p => p.Pack(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<bool>(),
Arg.Any<bool>())).Do( callInfo => {
_fileSystem.AddEmptyFile(callInfo[1].ToString());
FileSystem.AddEmptyFile(callInfo[1].ToString());
});
var scriptExecutor = Substitute.For<ISqlScriptExecutor>();
var serviceUrlBuilder = Substitute.For<IServiceUrlBuilder>();
var logger = Substitute.For<ILogger>();
var clioFileSystem = new FileSystem(_fileSystem);
var clioFileSystem = new FileSystem(FileSystem);
ApplicationInstaller applicationInstaller = new ApplicationInstaller(environmentSettings,
applicationClientFactory,
application,
Expand All @@ -77,7 +77,7 @@ public void RestartApplicationAfterInstallFolderInNet6() {
[Test]
public void CatchRestartApplicationErrorAfterInstallFolderInNet6() {
string packageFolderPath = "T:\\TestClioPackageFolder";
_fileSystem.AddDirectory(packageFolderPath);
FileSystem.AddDirectory(packageFolderPath);
EnvironmentSettings environmentSettings = new EnvironmentSettings();
environmentSettings.IsNetCore = true;
var applicationClientFactory = Substitute.For<IApplicationClientFactory>();
Expand All @@ -86,12 +86,12 @@ public void CatchRestartApplicationErrorAfterInstallFolderInNet6() {
var packageArchiver = Substitute.For<IPackageArchiver>();
packageArchiver.When(p => p.Pack(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<bool>(),
Arg.Any<bool>())).Do(callInfo => {
_fileSystem.AddEmptyFile(callInfo[1].ToString());
FileSystem.AddEmptyFile(callInfo[1].ToString());
});
var scriptExecutor = Substitute.For<ISqlScriptExecutor>();
var serviceUrlBuilder = Substitute.For<IServiceUrlBuilder>();
var logger = Substitute.For<ILogger>();
var clioFileSystem = new FileSystem(_fileSystem);
var clioFileSystem = new FileSystem(FileSystem);
ApplicationInstaller applicationInstaller = new ApplicationInstaller(environmentSettings,
applicationClientFactory,
application,
Expand Down
2 changes: 1 addition & 1 deletion clio.tests/Command/AssemblyCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected override void AdditionalRegistrations(ContainerBuilder containerBuilde
[Category("Unit")]
public void Execute_ShouldWriteResponse_WhenItIsSuccessful(){
// Arrange
AssemblyCommand command = _container.Resolve<AssemblyCommand>();
AssemblyCommand command = Container.Resolve<AssemblyCommand>();
command.Logger = _loggerMock;

string executorType = typeof(AssemblyCommand).FullName;
Expand Down
14 changes: 7 additions & 7 deletions clio.tests/Command/BaseClioModuleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@

namespace Clio.Tests.Command;

[TestFixture]
[TestFixture(Category = "UnitTests")]
public abstract class BaseClioModuleTests
{

#region Setup/Teardown

[SetUp]
public virtual void Setup(){
_fileSystem = CreateFs();
BindingsModule bindingModule = new(_fileSystem);
_container = bindingModule.Register(_environmentSettings, true, AdditionalRegistrations);
FileSystem = CreateFs();
BindingsModule bindingModule = new(FileSystem);
Container = bindingModule.Register(EnvironmentSettings, true, AdditionalRegistrations);
}

#endregion

#region Fields: Protected

protected MockFileSystem _fileSystem;
protected IContainer _container;
protected EnvironmentSettings _environmentSettings = new() {
protected MockFileSystem FileSystem;
protected IContainer Container;
protected EnvironmentSettings EnvironmentSettings = new() {
Uri = "http://localhost",
Login = "",
Password = ""
Expand Down
20 changes: 10 additions & 10 deletions clio.tests/Command/DownloadSettingsToManifestCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ public void SaveWebServiceToFile() {
ILogger loggerMock = Substitute.For<ILogger>();

SaveSettingsToManifestCommand command = new(providerMock, loggerMock,
_container.Resolve<Clio.Common.IFileSystem>(), _container.Resolve<ISerializer>(), webServiceManagerMock, _container.Resolve<IEnvironmentManager>());
Container.Resolve<Clio.Common.IFileSystem>(), Container.Resolve<ISerializer>(), webServiceManagerMock, Container.Resolve<IEnvironmentManager>());

//Act
command.Execute(saveSettingsToManifestOptions);


//Assert
_fileSystem.File.Exists(saveSettingsToManifestOptions.ManifestFileName).Should().BeTrue();
FileSystem.File.Exists(saveSettingsToManifestOptions.ManifestFileName).Should().BeTrue();
string expectedContent
= TestFileSystem.ReadExamplesFile("deployments-manifest", "expected-saved-manifest.yaml");
_fileSystem.File.ReadAllText(saveSettingsToManifestOptions.ManifestFileName).Trim().Should()
FileSystem.File.ReadAllText(saveSettingsToManifestOptions.ManifestFileName).Trim().Should()
.Be(expectedContent.Trim());

loggerMock.Received(1).WriteInfo("Done");
Expand Down Expand Up @@ -172,7 +172,7 @@ string expectedContent
}

private IContainer GetContainer() {
return MockDataContainer.GetContainer(_fileSystem);
return MockDataContainer.GetContainer(FileSystem);
}

[TestCase(true)]
Expand Down Expand Up @@ -204,16 +204,16 @@ public void SaveEnvironmentSettingsEmptyPackagesToFile(bool accending) {
ILogger loggerMock = Substitute.For<ILogger>();

SaveSettingsToManifestCommand command = new(providerMock, loggerMock,
_container.Resolve<Clio.Common.IFileSystem>(), _container.Resolve<ISerializer>(), webServiceManagerMock, _container.Resolve<IEnvironmentManager>());
Container.Resolve<Clio.Common.IFileSystem>(), Container.Resolve<ISerializer>(), webServiceManagerMock, Container.Resolve<IEnvironmentManager>());

//Act
command.Execute(saveSettingsToManifestOptions);

//Assert
_fileSystem.File.Exists(saveSettingsToManifestOptions.ManifestFileName).Should().BeTrue();
FileSystem.File.Exists(saveSettingsToManifestOptions.ManifestFileName).Should().BeTrue();
string expectedContent
= TestFileSystem.ReadExamplesFile("deployments-manifest", "expected-saved-full-manifest-WithoutSchemas.yaml");
_fileSystem.File.ReadAllText(saveSettingsToManifestOptions.ManifestFileName).Trim().Should()
FileSystem.File.ReadAllText(saveSettingsToManifestOptions.ManifestFileName).Trim().Should()
.Be(expectedContent.Trim());

loggerMock.Received(1).WriteInfo("Done");
Expand Down Expand Up @@ -251,16 +251,16 @@ public void SaveEnvironmentSettingsPackagesWithSchemasToFile(bool packageAccendi
ILogger loggerMock = Substitute.For<ILogger>();

SaveSettingsToManifestCommand command = new(providerMock, loggerMock,
_container.Resolve<Clio.Common.IFileSystem>(), _container.Resolve<ISerializer>(), webServiceManagerMock, _container.Resolve<IEnvironmentManager>());
Container.Resolve<Clio.Common.IFileSystem>(), Container.Resolve<ISerializer>(), webServiceManagerMock, Container.Resolve<IEnvironmentManager>());

//Act
command.Execute(saveSettingsToManifestOptions);

//Assert
_fileSystem.File.Exists(saveSettingsToManifestOptions.ManifestFileName).Should().BeTrue();
FileSystem.File.Exists(saveSettingsToManifestOptions.ManifestFileName).Should().BeTrue();
string expectedContent
= TestFileSystem.ReadExamplesFile("deployments-manifest", "expected-saved-full-manifest.yaml");
_fileSystem.File.ReadAllText(saveSettingsToManifestOptions.ManifestFileName).Trim().Should()
FileSystem.File.ReadAllText(saveSettingsToManifestOptions.ManifestFileName).Trim().Should()
.Be(expectedContent.Trim());

loggerMock.Received(1).WriteInfo("Done");
Expand Down
2 changes: 1 addition & 1 deletion clio.tests/Command/ListInstalledAppsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void Repository_ShouldBeCalled()
DataProviderMock dataProviderMock = new ();
ILogger loggerMock = Substitute.For<ILogger>();
IApplicationClient applicationClientMock = Substitute.For<IApplicationClient>();
ListInstalledAppsCommand command = new(dataProviderMock, loggerMock, applicationClientMock, _environmentSettings);
ListInstalledAppsCommand command = new(dataProviderMock, loggerMock, applicationClientMock, EnvironmentSettings);
ListInstalledAppsOptions options = new();

var mock = dataProviderMock
Expand Down
12 changes: 6 additions & 6 deletions clio.tests/Command/MockDataCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ protected override MockFileSystem CreateFs(){

[Test]
public void CreateDataFiles(){
FileSystem clioFileSystem = new FileSystem(_fileSystem);
FileSystem clioFileSystem = new FileSystem(FileSystem);
// Arrange
MockDataCommand command = new MockDataCommand(null, null, clioFileSystem);
MockDataCommandOptions options = new MockDataCommandOptions {
Models = @"T:\MockDataProjects",
Data = @"T:\MockDataProjects\Tests\MockData"
};
command.Execute(options);
_fileSystem.Directory.Exists(options.Models).Should().BeTrue();
_fileSystem.Directory.Exists(options.Data).Should().BeTrue();
FileSystem.Directory.Exists(options.Models).Should().BeTrue();
FileSystem.Directory.Exists(options.Data).Should().BeTrue();
}

[Test]
public void FindModels(){
// Arrange
FileSystem clioFileSystem = new FileSystem(_fileSystem);
FileSystem clioFileSystem = new FileSystem(FileSystem);
MockDataCommand command = new MockDataCommand(null, null, clioFileSystem);
MockDataCommandOptions options = new MockDataCommandOptions {
Models = @"T:/MockDataProjects",
Expand All @@ -57,7 +57,7 @@ public void FindModels(){
[Test]
public void GetODataData(){
// Arrange
FileSystem clioFileSystem = new FileSystem(_fileSystem);
FileSystem clioFileSystem = new FileSystem(FileSystem);
IApplicationClient mockCreatioClient = Substitute.For<IApplicationClient>();
string contactExpectedContent
= clioFileSystem.ReadAllText(Path.Combine("T:/MockDataProjects", "Expected", "Contact.json"));
Expand All @@ -84,7 +84,7 @@ string accountExpectedContent

//Assert
List<string> models = command.FindModels(options.Models);
string[] dataFiles = _fileSystem.Directory.GetFiles(options.Data, "*.json", SearchOption.AllDirectories);
string[] dataFiles = FileSystem.Directory.GetFiles(options.Data, "*.json", SearchOption.AllDirectories);
dataFiles.Count().Should().Be(models.Count);
foreach (string dataFile in dataFiles) {
string model = Path.GetFileNameWithoutExtension(dataFile);
Expand Down
18 changes: 9 additions & 9 deletions clio.tests/Command/PingAppCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ protected override void AdditionalRegistrations(ContainerBuilder containerBuilde
[TestCase(false)]
public void PingAppCommandShouldBeUsesAllRetryOptions(bool isNetCore) {
//Arrange
_environmentSettings.IsNetCore = isNetCore;
_fileSystem = CreateFs();
BindingsModule bindingModule = new(_fileSystem);
_container = bindingModule.Register(_environmentSettings, true, AdditionalRegistrations);
EnvironmentSettings.IsNetCore = isNetCore;
FileSystem = CreateFs();
BindingsModule bindingModule = new(FileSystem);
Container = bindingModule.Register(EnvironmentSettings, true, AdditionalRegistrations);

PingAppCommand command = _container.Resolve<PingAppCommand>();
PingAppCommand command = Container.Resolve<PingAppCommand>();
PingAppOptions options = new PingAppOptions() { TimeOut = 1, RetryCount = 2, RetryDelay = 3 };

// Act
Expand All @@ -50,10 +50,10 @@ public void PingAppCommandShouldBeUsesAllRetryOptions(bool isNetCore) {
[TestCase(false)]
public void PingAppCommandShouldBeUsesAllRetryOptionsOnNet6Environment(bool isNetCore) {
//Arrange
_fileSystem = CreateFs();
BindingsModule bindingModule = new(_fileSystem);
_container = bindingModule.Register(_environmentSettings, true, AdditionalRegistrations);
PingAppCommand command = _container.Resolve<PingAppCommand>();
FileSystem = CreateFs();
BindingsModule bindingModule = new(FileSystem);
Container = bindingModule.Register(EnvironmentSettings, true, AdditionalRegistrations);
PingAppCommand command = Container.Resolve<PingAppCommand>();
PingAppOptions options = new PingAppOptions() {
TimeOut = 1,
RetryCount = 2,
Expand Down
Loading
Loading