From 4e698da78f8d7c07af6f18c6dca56d7ec74e415a Mon Sep 17 00:00:00 2001 From: Clemens Geibel Date: Fri, 24 Jun 2022 15:13:14 +0200 Subject: [PATCH] Adjusted installation of DeltaChat --- .../provs/desktop/domain/DesktopService.kt | 2 +- .../provs/desktop/infrastructure/DeltaChat.kt | 10 ++++++++++ .../desktop/infrastructure/PackageBundles.kt | 2 -- .../desktop/domain/DesktopServiceKtTest.kt | 17 +++++++++++++++++ .../desktop/infrastructure/DeltaChatKtTest.kt | 19 +++++++++++++++++++ 5 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/DeltaChat.kt create mode 100644 src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/DeltaChatKtTest.kt diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt index 4044a12..e53ce95 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt @@ -79,7 +79,7 @@ fun Prov.provisionDesktop( aptInstall(BROWSER) aptInstall(EMAIL_CLIENT) - aptInstall(MESSENGER) + installDeltaChat() aptInstall(OFFICE_SUITE) aptInstall(CLIP_TOOLS) diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/DeltaChat.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/DeltaChat.kt new file mode 100644 index 0000000..bc07f08 --- /dev/null +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/DeltaChat.kt @@ -0,0 +1,10 @@ +package org.domaindrivenarchitecture.provs.desktop.infrastructure + +import org.domaindrivenarchitecture.provs.framework.core.Prov +import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall + +fun Prov.installDeltaChat() = task { + aptInstall("flatpak ca-certificates") + cmd("sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo") + cmd("sudo flatpak install -y --noninteractive flathub chat.delta.desktop") +} \ No newline at end of file diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/PackageBundles.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/PackageBundles.kt index 9d34b34..75027c9 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/PackageBundles.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/PackageBundles.kt @@ -12,8 +12,6 @@ val BROWSER = "firefox chromium-browser" val EMAIL_CLIENT = "thunderbird" -val MESSENGER = "deltachat-desktop" - val OFFICE_SUITE = "libreoffice" val CLIP_TOOLS = "xclip" diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopServiceKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopServiceKtTest.kt index a619a89..6fe4fc5 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopServiceKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopServiceKtTest.kt @@ -45,6 +45,23 @@ internal class DesktopServiceKtTest { assertTrue(res.success) } + @ExtensiveContainerTest + fun provisionIDEDesktop() { + // given + val prov = defaultTestContainer() + + // when + // in order to test DesktopType.OFFICE: fix installing libreoffice for a fresh container as it hangs the first time but succeeds 2nd time + val res = prov.provisionDesktop( + DesktopType.IDE, + gitUserName = "testuser", + gitEmail = "testuser@test.org", + ) + + // then + assertTrue(res.success) + } + @ExtensiveContainerTest fun provisionDesktopFromConfigFile() { diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/DeltaChatKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/DeltaChatKtTest.kt new file mode 100644 index 0000000..69757e6 --- /dev/null +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/DeltaChatKtTest.kt @@ -0,0 +1,19 @@ +package org.domaindrivenarchitecture.provs.desktop.infrastructure + +import org.domaindrivenarchitecture.provs.test.defaultTestContainer +import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest +import org.junit.jupiter.api.Assertions.assertTrue + +class DeltaChatKtTest { + + @ExtensiveContainerTest + fun installDeltaChat() { + // given + val a = defaultTestContainer() + // when + val res = a.task { installDeltaChat() } + // then + assertTrue(res.success) + } + +}