Search in sources :

Example 1 with CommandRunnerOption

use of bio.terra.cli.businessobject.Config.CommandRunnerOption in project terra-cli by DataBiosphere.

the class Config method getValueList.

@Test
@DisplayName("config get and list always match")
void getValueList() throws IOException {
    // toggle each config value and make sure config get and list always match.
    // server and workspace config properties are not included here because they are covered by
    // tests above.
    // `terra config set browser MANUAL`
    TestCommand.runCommandExpectSuccess("config", "set", "browser", "MANUAL");
    // `terra config get browser`
    BrowserLaunchOption browser = TestCommand.runAndParseCommandExpectSuccess(BrowserLaunchOption.class, "config", "get", "browser");
    assertEquals(BrowserLaunchOption.MANUAL, browser, "get reflects set for browser");
    // `terra config list`
    UFConfig config = TestCommand.runAndParseCommandExpectSuccess(UFConfig.class, "config", "list");
    assertEquals(BrowserLaunchOption.MANUAL, config.browserLaunchOption, "list reflects set for browser");
    // `terra config set app-launch LOCAL_PROCESS`
    TestCommand.runCommandExpectSuccess("config", "set", "app-launch", "LOCAL_PROCESS");
    // `terra config get app-launch`
    CommandRunnerOption appLaunch = TestCommand.runAndParseCommandExpectSuccess(CommandRunnerOption.class, "config", "get", "app-launch");
    assertEquals(CommandRunnerOption.LOCAL_PROCESS, appLaunch, "get reflects set for app-launch");
    // `terra config list`
    config = TestCommand.runAndParseCommandExpectSuccess(UFConfig.class, "config", "list");
    assertEquals(CommandRunnerOption.LOCAL_PROCESS, config.commandRunnerOption, "list reflects set for app-launch");
    // `terra config set image --image=badimageid123`
    String imageId = "badimageid123";
    TestCommand.runCommandExpectSuccess("config", "set", "image", "--image=" + imageId);
    // `terra config get image`
    String image = TestCommand.runAndParseCommandExpectSuccess(String.class, "config", "get", "image");
    assertEquals(imageId, image, "get reflects set for image");
    // `terra config list`
    config = TestCommand.runAndParseCommandExpectSuccess(UFConfig.class, "config", "list");
    assertEquals(imageId, config.dockerImageId, "list reflects set for image");
    // `terra config set resource-limit --max=3`
    TestCommand.runCommandExpectSuccess("config", "set", "resource-limit", "--max=3");
    // `terra config get resource-limit`
    int resourceLimit = TestCommand.runAndParseCommandExpectSuccess(Integer.class, "config", "get", "resource-limit");
    assertEquals(3, resourceLimit, "get reflects set for resource-limit");
    // `terra config list`
    config = TestCommand.runAndParseCommandExpectSuccess(UFConfig.class, "config", "list");
    assertEquals(3, config.resourcesCacheSize, "list reflects set for resource-limit");
    // `terra config set logging --console --level=ERROR`
    TestCommand.runCommandExpectSuccess("config", "set", "logging", "--console", "--level=ERROR");
    // `terra config set logging --file --level=TRACE`
    TestCommand.runCommandExpectSuccess("config", "set", "logging", "--file", "--level=TRACE");
    // `terra config get logging`
    UFLoggingConfig logging = TestCommand.runAndParseCommandExpectSuccess(UFLoggingConfig.class, "config", "get", "logging");
    assertEquals(Logger.LogLevel.ERROR, logging.consoleLoggingLevel, "get reflects set for console logging");
    assertEquals(Logger.LogLevel.TRACE, logging.fileLoggingLevel, "get reflects set for file logging");
    // `terra config list`
    config = TestCommand.runAndParseCommandExpectSuccess(UFConfig.class, "config", "list");
    assertEquals(Logger.LogLevel.ERROR, config.consoleLoggingLevel, "list reflects set for console logging");
    assertEquals(Logger.LogLevel.TRACE, config.fileLoggingLevel, "list reflects set for file logging");
}
Also used : CommandRunnerOption(bio.terra.cli.businessobject.Config.CommandRunnerOption) UFLoggingConfig(bio.terra.cli.serialization.userfacing.UFLoggingConfig) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) BrowserLaunchOption(bio.terra.cli.businessobject.Config.BrowserLaunchOption) UFConfig(bio.terra.cli.serialization.userfacing.UFConfig) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

BrowserLaunchOption (bio.terra.cli.businessobject.Config.BrowserLaunchOption)1 CommandRunnerOption (bio.terra.cli.businessobject.Config.CommandRunnerOption)1 UFConfig (bio.terra.cli.serialization.userfacing.UFConfig)1 UFLoggingConfig (bio.terra.cli.serialization.userfacing.UFLoggingConfig)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 DisplayName (org.junit.jupiter.api.DisplayName)1 Test (org.junit.jupiter.api.Test)1