From 6537058ecf81a563d7522488370eba9cc8f50634 Mon Sep 17 00:00:00 2001 From: az Date: Wed, 18 Jan 2023 09:10:19 +0100 Subject: [PATCH] branch initial commit --- Dockerfile | 4 +++- .../desktop/domain/DesktopServiceKtTest.kt | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d4e435f..944a9e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,11 @@ FROM ubuntu:latest ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get -y install apt-utils sudo -RUN useradd -m testuser && echo "testuser:testuser" | chpasswd && adduser testuser sudo +RUN useradd -m testuser && echo "testuserpw:testuser" | chpasswd && adduser testuser sudo RUN echo "testuser ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/testuser +RUN useradd testuser2 && echo "testuser2pw:testuser2" | chpasswd && adduser testuser2 sudo + USER testuser CMD /bin/bash WORKDIR /home/testuser 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 5b32e73..279b9bb 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopServiceKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopServiceKtTest.kt @@ -3,6 +3,7 @@ package org.domaindrivenarchitecture.provs.desktop.domain import org.domaindrivenarchitecture.provs.desktop.infrastructure.getConfig import org.domaindrivenarchitecture.provs.framework.core.remote import org.domaindrivenarchitecture.provs.test.defaultTestContainer +import org.domaindrivenarchitecture.provs.test.tags.ContainerTest import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Disabled @@ -10,6 +11,24 @@ import org.junit.jupiter.api.Test internal class DesktopServiceKtTest { + @ContainerTest + fun provisionLocalDesktop_fails_if_user_cannot_sudo_without_password() { + // given + val prov = + + // 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.BASIC, + gitUserName = "testuser", + gitEmail = "testuser@test.org", + onlyModules = null + ) + + // then + assertTrue(res.success) + } + @ExtensiveContainerTest fun provisionDesktop() { // given