From 0941a4709ec28753843bff9e4cc3fe7a90d1df7c Mon Sep 17 00:00:00 2001 From: Dominik Guhr Date: Wed, 23 Mar 2022 09:36:20 -0700 Subject: [PATCH] Fixes windows configuration test also fixes using ~ as database default for e.g. IDELauncher (does not work on all windows versions) also fixes the HelpCommandTest, as approvalTests are now generated based on the OS the tests run Closes #10246 Co-authored-by: Victor-Philipp Negoescu --- .../runtime/storage/database/Database.java | 2 +- .../configuration/test/ConfigurationTest.java | 2 +- .../it/junit5/extension/CLIResult.java | 4 +- .../approvalTests/KcNamerFactory.java | 12 ++ .../WindowsOrUnixOsEnvironmentLabeller.java | 24 +++ ...mmandTest.testBuildHelp.unix.approved.txt} | 0 ...andTest.testBuildHelp.windows.approved.txt | 107 +++++++++++ ...dTest.testDefaultToHelp.unix.approved.txt} | 0 ...est.testDefaultToHelp.windows.approved.txt | 55 ++++++ ...elpCommandTest.testHelp.unix.approved.txt} | 0 ...pCommandTest.testHelp.windows.approved.txt | 55 ++++++ ...mmandTest.testHelpShort.unix.approved.txt} | 0 ...andTest.testHelpShort.windows.approved.txt | 55 ++++++ ...ndTest.testStartDevHelp.unix.approved.txt} | 0 ...Test.testStartDevHelp.windows.approved.txt | 132 +++++++++++++ ...est.testStartDevHelpAll.unix.approved.txt} | 0 ...t.testStartDevHelpAll.windows.approved.txt | 174 ++++++++++++++++++ ...mmandTest.testStartHelp.unix.approved.txt} | 0 ...andTest.testStartHelp.windows.approved.txt | 138 ++++++++++++++ 19 files changed, 757 insertions(+), 3 deletions(-) create mode 100644 quarkus/tests/integration/src/main/java/org/keycloak/it/junit5/extension/approvalTests/KcNamerFactory.java create mode 100644 quarkus/tests/integration/src/main/java/org/keycloak/it/junit5/extension/approvalTests/WindowsOrUnixOsEnvironmentLabeller.java rename quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/{HelpCommandTest.testBuildHelp.approved.txt => HelpCommandTest.testBuildHelp.unix.approved.txt} (100%) create mode 100644 quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testBuildHelp.windows.approved.txt rename quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/{HelpCommandTest.testDefaultToHelp.approved.txt => HelpCommandTest.testDefaultToHelp.unix.approved.txt} (100%) create mode 100644 quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testDefaultToHelp.windows.approved.txt rename quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/{HelpCommandTest.testHelp.approved.txt => HelpCommandTest.testHelp.unix.approved.txt} (100%) create mode 100644 quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testHelp.windows.approved.txt rename quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/{HelpCommandTest.testHelpShort.approved.txt => HelpCommandTest.testHelpShort.unix.approved.txt} (100%) create mode 100644 quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testHelpShort.windows.approved.txt rename quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/{HelpCommandTest.testStartDevHelp.approved.txt => HelpCommandTest.testStartDevHelp.unix.approved.txt} (100%) create mode 100644 quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelp.windows.approved.txt rename quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/{HelpCommandTest.testStartDevHelpAll.approved.txt => HelpCommandTest.testStartDevHelpAll.unix.approved.txt} (100%) create mode 100644 quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelpAll.windows.approved.txt rename quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/{HelpCommandTest.testStartHelp.approved.txt => HelpCommandTest.testStartHelp.unix.approved.txt} (100%) create mode 100644 quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelp.windows.approved.txt diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/database/Database.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/database/Database.java index 90f8f08d5c..f672acff7c 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/database/Database.java +++ b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/database/Database.java @@ -105,7 +105,7 @@ public final class Database { @Override public String apply(String alias) { if ("dev-file".equalsIgnoreCase(alias)) { - return "jdbc:h2:file:${kc.home.dir:${kc.db-url-path:~}}" + File.separator + "${kc.data.dir:data}" + return "jdbc:h2:file:${kc.home.dir:${kc.db-url-path:" + System.getProperty("user.home") + "}}" + File.separator + "${kc.data.dir:data}" + File.separator + "h2" + File.separator + "keycloakdb${kc.db-url-properties:;;AUTO_SERVER=TRUE}"; } diff --git a/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/test/ConfigurationTest.java b/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/test/ConfigurationTest.java index 5b57f1e8ec..be34e0ec16 100644 --- a/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/test/ConfigurationTest.java +++ b/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/test/ConfigurationTest.java @@ -237,7 +237,7 @@ public class ConfigurationTest { System.setProperty(CLI_ARGS, "--db=dev-file"); SmallRyeConfig config = createConfig(); assertEquals(QuarkusH2Dialect.class.getName(), config.getConfigValue("quarkus.hibernate-orm.dialect").getValue()); - assertEquals("jdbc:h2:file:~/data/h2/keycloakdb;;AUTO_SERVER=TRUE", config.getConfigValue("quarkus.datasource.jdbc.url").getValue()); + assertEquals("jdbc:h2:file:" + System.getProperty("user.home") + File.separator + "data" + File.separator + "h2" + File.separator + "keycloakdb;;AUTO_SERVER=TRUE", config.getConfigValue("quarkus.datasource.jdbc.url").getValue()); System.setProperty(CLI_ARGS, "--db=dev-mem"); config = createConfig(); diff --git a/quarkus/tests/integration/src/main/java/org/keycloak/it/junit5/extension/CLIResult.java b/quarkus/tests/integration/src/main/java/org/keycloak/it/junit5/extension/CLIResult.java index 8e8df7df5c..f655699fbd 100644 --- a/quarkus/tests/integration/src/main/java/org/keycloak/it/junit5/extension/CLIResult.java +++ b/quarkus/tests/integration/src/main/java/org/keycloak/it/junit5/extension/CLIResult.java @@ -28,6 +28,8 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import org.approvaltests.Approvals; import io.quarkus.test.junit.main.LaunchResult; +import org.approvaltests.namer.NamedEnvironment; +import org.keycloak.it.junit5.extension.approvalTests.KcNamerFactory; public interface CLIResult extends LaunchResult { @@ -72,7 +74,7 @@ public interface CLIResult extends LaunchResult { } default void assertHelp() { - try { + try (NamedEnvironment env = KcNamerFactory.asWindowsOsSpecificTest()) { Approvals.verify(getOutput()); } catch (Exception cause) { throw new RuntimeException("Failed to assert help", cause); diff --git a/quarkus/tests/integration/src/main/java/org/keycloak/it/junit5/extension/approvalTests/KcNamerFactory.java b/quarkus/tests/integration/src/main/java/org/keycloak/it/junit5/extension/approvalTests/KcNamerFactory.java new file mode 100644 index 0000000000..464f1aeb88 --- /dev/null +++ b/quarkus/tests/integration/src/main/java/org/keycloak/it/junit5/extension/approvalTests/KcNamerFactory.java @@ -0,0 +1,12 @@ +package org.keycloak.it.junit5.extension.approvalTests; + +import org.approvaltests.namer.NamedEnvironment; +import org.approvaltests.namer.NamerFactory; + +public class KcNamerFactory extends NamerFactory { + + public static NamedEnvironment asWindowsOsSpecificTest() + { + return asMachineSpecificTest(new WindowsOrUnixOsEnvironmentLabeller()); + } +} diff --git a/quarkus/tests/integration/src/main/java/org/keycloak/it/junit5/extension/approvalTests/WindowsOrUnixOsEnvironmentLabeller.java b/quarkus/tests/integration/src/main/java/org/keycloak/it/junit5/extension/approvalTests/WindowsOrUnixOsEnvironmentLabeller.java new file mode 100644 index 0000000000..4f258823f4 --- /dev/null +++ b/quarkus/tests/integration/src/main/java/org/keycloak/it/junit5/extension/approvalTests/WindowsOrUnixOsEnvironmentLabeller.java @@ -0,0 +1,24 @@ +package org.keycloak.it.junit5.extension.approvalTests; + +import org.lambda.functions.Function0; + +import java.util.Locale; + +public class WindowsOrUnixOsEnvironmentLabeller implements Function0 { + + private static final String WINDOWS_NAME = "windows"; + private static final String UNIX_NAME = "unix"; + + @Override + public String call() + { + String osName = System.getProperty("os.name"); + + if(osName.toLowerCase(Locale.ROOT).contains(WINDOWS_NAME)) { + return WINDOWS_NAME; + } + + //unix suffices, as basically all other OSses use sh files + return UNIX_NAME; + } +} diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testBuildHelp.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testBuildHelp.unix.approved.txt similarity index 100% rename from quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testBuildHelp.approved.txt rename to quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testBuildHelp.unix.approved.txt diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testBuildHelp.windows.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testBuildHelp.windows.approved.txt new file mode 100644 index 0000000000..1c05a8f8b1 --- /dev/null +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testBuildHelp.windows.approved.txt @@ -0,0 +1,107 @@ +Creates a new and optimized server image. + +Usage: + +kc.bat build [OPTIONS] + +Creates a new and optimized server image based on the configuration options +passed to this command. Once created, the configuration will be persisted and +read during startup without having to pass them over again. + +Some configuration options require this command to be executed in order to +actually change a configuration. For instance + +- Change database vendor +- Enable/disable features +- Enable/Disable providers or set a default + +Consider running this command before running the server in production for an +optimal runtime. + +Options: + +-h, --help This help message. + +Cluster: + +--cache Defines the cache mechanism for high-availability. By default, a 'ispn' cache + is used to create a cluster between multiple server nodes. A 'local' cache + disables clustering and is intended for development and testing purposes. + Default: ispn. +--cache-config-file + Defines the file from which cache configuration should be loaded from. +--cache-stack + Define the default stack to use for cluster communication and node discovery. + This option only takes effect if 'cache' is set to 'ispn'. Default: udp. + +Database: + +--db The database vendor. Possible values are: dev-file, dev-mem, mariadb, mssql, + mysql, oracle, postgres + +Transaction: + +--transaction-xa-enabled + Manually override the transaction type. Transaction type XA and the + appropriate driver is used by default. Default: true. + +Feature: + +--features Enables a set of one or more features. +--features-disabled + Disables a set of one or more features. + +HTTP/TLS: + +--http-relative-path + Set the path relative to '/' for serving resources. Default: /. + +Health: + +--health-enabled + If the server should expose health check endpoints. If enabled, health checks + are available at the '/health', '/health/ready' and '/health/live' + endpoints. Default: false. + +Metrics: + +--metrics-enabled + If the server should expose metrics. If enabled, metrics are available at the + '/metrics' endpoint. Default: false. + +Vault: + +--vault Enables a vault provider. + +Examples: + + Change the database vendor: + + $ kc.bat build --db=postgres + + Enable a feature: + + $ kc.bat build --features= + + Or alternatively, enable all tech preview features: + + $ kc.bat build --features=preview + + Enable health endpoints: + + $ kc.bat build --health-enabled=true + + Enable metrics endpoints: + + $ kc.bat build --metrics-enabled=true + + Change the relative path: + + $ kc.bat build --http-relative-path=/auth + +You can also use the "--auto-build" option when starting the server to avoid +running this command every time you change a configuration: + + $ kc.bat start --auto-build + +By doing that you have an additional overhead when the server is starting. \ No newline at end of file diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testDefaultToHelp.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testDefaultToHelp.unix.approved.txt similarity index 100% rename from quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testDefaultToHelp.approved.txt rename to quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testDefaultToHelp.unix.approved.txt diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testDefaultToHelp.windows.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testDefaultToHelp.windows.approved.txt new file mode 100644 index 0000000000..7705feb2aa --- /dev/null +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testDefaultToHelp.windows.approved.txt @@ -0,0 +1,55 @@ +Keycloak - Open Source Identity and Access Management + +Find more information at: https://www.keycloak.org/docs/latest + +Usage: + +kc.bat [OPTIONS] [COMMAND] + +Use this command-line tool to manage your Keycloak cluster. +Make sure the command is available on your "PATH" or prefix it with "./" (e.g.: +"./kc.bat") to execute from the current folder. + +Options: + +-cf, --config-file + Set the path to a configuration file. By default, configuration properties are + read from the "keycloak.conf" file in the "conf" directory. +-h, --help This help message. +-v, --verbose Print out error details when running this command. +-V, --version Show version information + +Commands: + + build Creates a new and optimized server image. + start Start the server. + start-dev Start the server in development mode. + export Export data from realms to a file or directory. + import Import data from a directory or a file. + show-config Print out the current configuration. + tools Utilities for use and interaction with the server. + completion Generate bash/zsh completion script for kc.bat. + +Examples: + + Start the server in development mode for local development or testing: + + $ kc.bat start-dev + + Building an optimized server runtime: + + $ kc.bat build + + Start the server in production mode: + + $ kc.bat start + + Enable auto-completion to bash/zsh: + + $ source <(kc.bat tools completion) + + Please, take a look at the documentation for more details before deploying in +production. + +Use "kc.bat start --help" for the available options when starting the server. +Use "kc.bat --help" for more information about other commands. \ No newline at end of file diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testHelp.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testHelp.unix.approved.txt similarity index 100% rename from quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testHelp.approved.txt rename to quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testHelp.unix.approved.txt diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testHelp.windows.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testHelp.windows.approved.txt new file mode 100644 index 0000000000..7705feb2aa --- /dev/null +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testHelp.windows.approved.txt @@ -0,0 +1,55 @@ +Keycloak - Open Source Identity and Access Management + +Find more information at: https://www.keycloak.org/docs/latest + +Usage: + +kc.bat [OPTIONS] [COMMAND] + +Use this command-line tool to manage your Keycloak cluster. +Make sure the command is available on your "PATH" or prefix it with "./" (e.g.: +"./kc.bat") to execute from the current folder. + +Options: + +-cf, --config-file + Set the path to a configuration file. By default, configuration properties are + read from the "keycloak.conf" file in the "conf" directory. +-h, --help This help message. +-v, --verbose Print out error details when running this command. +-V, --version Show version information + +Commands: + + build Creates a new and optimized server image. + start Start the server. + start-dev Start the server in development mode. + export Export data from realms to a file or directory. + import Import data from a directory or a file. + show-config Print out the current configuration. + tools Utilities for use and interaction with the server. + completion Generate bash/zsh completion script for kc.bat. + +Examples: + + Start the server in development mode for local development or testing: + + $ kc.bat start-dev + + Building an optimized server runtime: + + $ kc.bat build + + Start the server in production mode: + + $ kc.bat start + + Enable auto-completion to bash/zsh: + + $ source <(kc.bat tools completion) + + Please, take a look at the documentation for more details before deploying in +production. + +Use "kc.bat start --help" for the available options when starting the server. +Use "kc.bat --help" for more information about other commands. \ No newline at end of file diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testHelpShort.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testHelpShort.unix.approved.txt similarity index 100% rename from quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testHelpShort.approved.txt rename to quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testHelpShort.unix.approved.txt diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testHelpShort.windows.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testHelpShort.windows.approved.txt new file mode 100644 index 0000000000..7705feb2aa --- /dev/null +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testHelpShort.windows.approved.txt @@ -0,0 +1,55 @@ +Keycloak - Open Source Identity and Access Management + +Find more information at: https://www.keycloak.org/docs/latest + +Usage: + +kc.bat [OPTIONS] [COMMAND] + +Use this command-line tool to manage your Keycloak cluster. +Make sure the command is available on your "PATH" or prefix it with "./" (e.g.: +"./kc.bat") to execute from the current folder. + +Options: + +-cf, --config-file + Set the path to a configuration file. By default, configuration properties are + read from the "keycloak.conf" file in the "conf" directory. +-h, --help This help message. +-v, --verbose Print out error details when running this command. +-V, --version Show version information + +Commands: + + build Creates a new and optimized server image. + start Start the server. + start-dev Start the server in development mode. + export Export data from realms to a file or directory. + import Import data from a directory or a file. + show-config Print out the current configuration. + tools Utilities for use and interaction with the server. + completion Generate bash/zsh completion script for kc.bat. + +Examples: + + Start the server in development mode for local development or testing: + + $ kc.bat start-dev + + Building an optimized server runtime: + + $ kc.bat build + + Start the server in production mode: + + $ kc.bat start + + Enable auto-completion to bash/zsh: + + $ source <(kc.bat tools completion) + + Please, take a look at the documentation for more details before deploying in +production. + +Use "kc.bat start --help" for the available options when starting the server. +Use "kc.bat --help" for more information about other commands. \ No newline at end of file diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelp.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelp.unix.approved.txt similarity index 100% rename from quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelp.approved.txt rename to quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelp.unix.approved.txt diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelp.windows.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelp.windows.approved.txt new file mode 100644 index 0000000000..b6f576c43a --- /dev/null +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelp.windows.approved.txt @@ -0,0 +1,132 @@ +Start the server in development mode. + +Usage: + +kc.bat start-dev [OPTIONS] + +Use this command if you want to run the server locally for development or +testing purposes. + +Options: + +-h, --help This help message. +--help-all This same help message but with additional options. +--import-realm Import realms during startup by reading any realm configuration file from the + 'data/import' directory. + +Database: + +--db-password + The password of the database user. +--db-pool-initial-size + The initial size of the connection pool. +--db-pool-max-size + The maximum size of the connection pool. Default: 100. +--db-pool-min-size + The minimal size of the connection pool. +--db-schema The database schema to be used. +--db-url The full database JDBC URL. If not provided, a default URL is set based on the + selected database vendor. For instance, if using 'postgres', the default + JDBC URL would be 'jdbc:postgresql://localhost/keycloak'. +--db-url-database + Sets the database name of the default JDBC URL of the chosen vendor. If the + `db-url` option is set, this option is ignored. +--db-url-host + Sets the hostname of the default JDBC URL of the chosen vendor. If the + `db-url` option is set, this option is ignored. +--db-url-properties + Sets the properties of the default JDBC URL of the chosen vendor. If the + `db-url` option is set, this option is ignored. +--db-username + The username of the database user. + +Hostname: + +--hostname + Hostname for the Keycloak server. +--hostname-path + This should be set if proxy uses a different context-path for Keycloak. +--hostname-port + The port used by the proxy when exposing the hostname. Set this option if the + proxy uses a port other than the default HTTP and HTTPS ports. Default: -1. +--hostname-strict + Disables dynamically resolving the hostname from request headers. Should + always be set to true in production, unless proxy verifies the Host header. + Default: true. +--hostname-strict-backchannel + By default backchannel URLs are dynamically resolved from request headers to + allow internal an external applications. If all applications use the public + URL this option should be enabled. Default: false. + +HTTP/TLS: + +--http-enabled + Enables the HTTP listener. Default: false. +--http-host The used HTTP Host. Default: 0.0.0.0. +--http-port The used HTTP port. Default: 8080. +--https-certificate-file + The file path to a server certificate or certificate chain in PEM format. +--https-certificate-key-file + The file path to a private key in PEM format. +--https-cipher-suites + The cipher suites to use. If none is given, a reasonable default is selected. +--https-client-auth + Configures the server to require/request client authentication. Possible + Values: none, request, required. Default: none. +--https-key-store-file + The key store which holds the certificate information instead of specifying + separate files. +--https-key-store-password + The password of the key store file. Default: password. +--https-key-store-type + The type of the key store file. If not given, the type is automatically + detected based on the file name. +--https-port The used HTTPS port. Default: 8443. +--https-protocols + The list of protocols to explicitly enable. Default: TLSv1.3. +--https-trust-store-file + The trust store which holds the certificate information of the certificates to + trust. +--https-trust-store-password + The password of the trust store file. +--https-trust-store-type + The type of the trust store file. If not given, the type is automatically + detected based on the file name. + +Proxy: + +--proxy The proxy address forwarding mode if the server is behind a reverse proxy. + Possible values are: edge,reencrypt,passthrough Default: none. + +Vault: + +--vault-dir If set, secrets can be obtained by reading the content of files within the + given directory. + +Logging: + +--log Enable one or more log handlers in a comma-separated list. Available log + handlers are: console,file Default: console. +--log-console-color + Enable or disable colors when logging to console. Default: false. +--log-console-format + The format of unstructured console log entries. If the format has spaces in + it, escape the value using "". Default: %d{yyyy-MM-dd HH:mm:ss,SSS} % + -5p [%c] (%t) %s%e%n. +--log-console-output + Set the log output to JSON or default (plain) unstructured logging. Default: + default. +--log-file /.log + Set the log file path and filename. Default: data\log\keycloak.log. +--log-file-format + Set a format specific to file log entries. Default: %d{yyyy-MM-dd HH:mm:ss, + SSS} %-5p [%c] (%t) %s%e%n. +--log-level + The log level of the root category or a comma-separated list of individual + categories and their levels. For the root category, you don't need to + specify a category. Default: info. + +Do NOT start the server using this command when deploying to production. + +Use 'kc.bat start-dev --help-all' to list all available options, including +build options. \ No newline at end of file diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelpAll.unix.approved.txt similarity index 100% rename from quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelpAll.approved.txt rename to quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelpAll.unix.approved.txt diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelpAll.windows.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelpAll.windows.approved.txt new file mode 100644 index 0000000000..5eb0af8390 --- /dev/null +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelpAll.windows.approved.txt @@ -0,0 +1,174 @@ +Start the server in development mode. + +Usage: + +kc.bat start-dev [OPTIONS] + +Use this command if you want to run the server locally for development or +testing purposes. + +Options: + +-h, --help This help message. +--help-all This same help message but with additional options. +--import-realm Import realms during startup by reading any realm configuration file from the + 'data/import' directory. + +Cluster: + +--cache Defines the cache mechanism for high-availability. By default, a 'ispn' cache + is used to create a cluster between multiple server nodes. A 'local' cache + disables clustering and is intended for development and testing purposes. + Default: ispn. +--cache-config-file + Defines the file from which cache configuration should be loaded from. +--cache-stack + Define the default stack to use for cluster communication and node discovery. + This option only takes effect if 'cache' is set to 'ispn'. Default: udp. + +Database: + +--db The database vendor. Possible values are: dev-file, dev-mem, mariadb, mssql, + mysql, oracle, postgres +--db-password + The password of the database user. +--db-pool-initial-size + The initial size of the connection pool. +--db-pool-max-size + The maximum size of the connection pool. Default: 100. +--db-pool-min-size + The minimal size of the connection pool. +--db-schema The database schema to be used. +--db-url The full database JDBC URL. If not provided, a default URL is set based on the + selected database vendor. For instance, if using 'postgres', the default + JDBC URL would be 'jdbc:postgresql://localhost/keycloak'. +--db-url-database + Sets the database name of the default JDBC URL of the chosen vendor. If the + `db-url` option is set, this option is ignored. +--db-url-host + Sets the hostname of the default JDBC URL of the chosen vendor. If the + `db-url` option is set, this option is ignored. +--db-url-properties + Sets the properties of the default JDBC URL of the chosen vendor. If the + `db-url` option is set, this option is ignored. +--db-username + The username of the database user. + +Transaction: + +--transaction-xa-enabled + Manually override the transaction type. Transaction type XA and the + appropriate driver is used by default. Default: true. + +Feature: + +--features Enables a set of one or more features. +--features-disabled + Disables a set of one or more features. + +Hostname: + +--hostname + Hostname for the Keycloak server. +--hostname-path + This should be set if proxy uses a different context-path for Keycloak. +--hostname-port + The port used by the proxy when exposing the hostname. Set this option if the + proxy uses a port other than the default HTTP and HTTPS ports. Default: -1. +--hostname-strict + Disables dynamically resolving the hostname from request headers. Should + always be set to true in production, unless proxy verifies the Host header. + Default: true. +--hostname-strict-backchannel + By default backchannel URLs are dynamically resolved from request headers to + allow internal an external applications. If all applications use the public + URL this option should be enabled. Default: false. + +HTTP/TLS: + +--http-enabled + Enables the HTTP listener. Default: false. +--http-host The used HTTP Host. Default: 0.0.0.0. +--http-port The used HTTP port. Default: 8080. +--http-relative-path + Set the path relative to '/' for serving resources. Default: /. +--https-certificate-file + The file path to a server certificate or certificate chain in PEM format. +--https-certificate-key-file + The file path to a private key in PEM format. +--https-cipher-suites + The cipher suites to use. If none is given, a reasonable default is selected. +--https-client-auth + Configures the server to require/request client authentication. Possible + Values: none, request, required. Default: none. +--https-key-store-file + The key store which holds the certificate information instead of specifying + separate files. +--https-key-store-password + The password of the key store file. Default: password. +--https-key-store-type + The type of the key store file. If not given, the type is automatically + detected based on the file name. +--https-port The used HTTPS port. Default: 8443. +--https-protocols + The list of protocols to explicitly enable. Default: TLSv1.3. +--https-trust-store-file + The trust store which holds the certificate information of the certificates to + trust. +--https-trust-store-password + The password of the trust store file. +--https-trust-store-type + The type of the trust store file. If not given, the type is automatically + detected based on the file name. + +Health: + +--health-enabled + If the server should expose health check endpoints. If enabled, health checks + are available at the '/health', '/health/ready' and '/health/live' + endpoints. Default: false. + +Metrics: + +--metrics-enabled + If the server should expose metrics. If enabled, metrics are available at the + '/metrics' endpoint. Default: false. + +Proxy: + +--proxy The proxy address forwarding mode if the server is behind a reverse proxy. + Possible values are: edge,reencrypt,passthrough Default: none. + +Vault: + +--vault Enables a vault provider. +--vault-dir If set, secrets can be obtained by reading the content of files within the + given directory. + +Logging: + +--log Enable one or more log handlers in a comma-separated list. Available log + handlers are: console,file Default: console. +--log-console-color + Enable or disable colors when logging to console. Default: false. +--log-console-format + The format of unstructured console log entries. If the format has spaces in + it, escape the value using "". Default: %d{yyyy-MM-dd HH:mm:ss,SSS} % + -5p [%c] (%t) %s%e%n. +--log-console-output + Set the log output to JSON or default (plain) unstructured logging. Default: + default. +--log-file /.log + Set the log file path and filename. Default: data\log\keycloak.log. +--log-file-format + Set a format specific to file log entries. Default: %d{yyyy-MM-dd HH:mm:ss, + SSS} %-5p [%c] (%t) %s%e%n. +--log-level + The log level of the root category or a comma-separated list of individual + categories and their levels. For the root category, you don't need to + specify a category. Default: info. + +Do NOT start the server using this command when deploying to production. + +Use 'kc.bat start-dev --help-all' to list all available options, including +build options. \ No newline at end of file diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelp.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelp.unix.approved.txt similarity index 100% rename from quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelp.approved.txt rename to quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelp.unix.approved.txt diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelp.windows.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelp.windows.approved.txt new file mode 100644 index 0000000000..2a8abc0807 --- /dev/null +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelp.windows.approved.txt @@ -0,0 +1,138 @@ +Start the server. + +Usage: + +kc.bat start [OPTIONS] + +Use this command to run the server in production. + +Options: + +-b, --auto-build Automatically detects whether the server configuration changed and a new + server image must be built prior to starting the server. This option + provides an alternative to manually running the 'build' prior to starting + the server. Use this configuration carefully in production as it might + impact the startup time. +-h, --help This help message. +--import-realm Import realms during startup by reading any realm configuration file from the + 'data/import' directory. + +Database: + +--db-password + The password of the database user. +--db-pool-initial-size + The initial size of the connection pool. +--db-pool-max-size + The maximum size of the connection pool. Default: 100. +--db-pool-min-size + The minimal size of the connection pool. +--db-schema The database schema to be used. +--db-url The full database JDBC URL. If not provided, a default URL is set based on the + selected database vendor. For instance, if using 'postgres', the default + JDBC URL would be 'jdbc:postgresql://localhost/keycloak'. +--db-url-database + Sets the database name of the default JDBC URL of the chosen vendor. If the + `db-url` option is set, this option is ignored. +--db-url-host + Sets the hostname of the default JDBC URL of the chosen vendor. If the + `db-url` option is set, this option is ignored. +--db-url-properties + Sets the properties of the default JDBC URL of the chosen vendor. If the + `db-url` option is set, this option is ignored. +--db-username + The username of the database user. + +Hostname: + +--hostname + Hostname for the Keycloak server. +--hostname-path + This should be set if proxy uses a different context-path for Keycloak. +--hostname-port + The port used by the proxy when exposing the hostname. Set this option if the + proxy uses a port other than the default HTTP and HTTPS ports. Default: -1. +--hostname-strict + Disables dynamically resolving the hostname from request headers. Should + always be set to true in production, unless proxy verifies the Host header. + Default: true. +--hostname-strict-backchannel + By default backchannel URLs are dynamically resolved from request headers to + allow internal an external applications. If all applications use the public + URL this option should be enabled. Default: false. + +HTTP/TLS: + +--http-enabled + Enables the HTTP listener. Default: false. +--http-host The used HTTP Host. Default: 0.0.0.0. +--http-port The used HTTP port. Default: 8080. +--https-certificate-file + The file path to a server certificate or certificate chain in PEM format. +--https-certificate-key-file + The file path to a private key in PEM format. +--https-cipher-suites + The cipher suites to use. If none is given, a reasonable default is selected. +--https-client-auth + Configures the server to require/request client authentication. Possible + Values: none, request, required. Default: none. +--https-key-store-file + The key store which holds the certificate information instead of specifying + separate files. +--https-key-store-password + The password of the key store file. Default: password. +--https-key-store-type + The type of the key store file. If not given, the type is automatically + detected based on the file name. +--https-port The used HTTPS port. Default: 8443. +--https-protocols + The list of protocols to explicitly enable. Default: TLSv1.3. +--https-trust-store-file + The trust store which holds the certificate information of the certificates to + trust. +--https-trust-store-password + The password of the trust store file. +--https-trust-store-type + The type of the trust store file. If not given, the type is automatically + detected based on the file name. + +Proxy: + +--proxy The proxy address forwarding mode if the server is behind a reverse proxy. + Possible values are: edge,reencrypt,passthrough Default: none. + +Vault: + +--vault-dir If set, secrets can be obtained by reading the content of files within the + given directory. + +Logging: + +--log Enable one or more log handlers in a comma-separated list. Available log + handlers are: console,file Default: console. +--log-console-color + Enable or disable colors when logging to console. Default: false. +--log-console-format + The format of unstructured console log entries. If the format has spaces in + it, escape the value using "". Default: %d{yyyy-MM-dd HH:mm:ss,SSS} % + -5p [%c] (%t) %s%e%n. +--log-console-output + Set the log output to JSON or default (plain) unstructured logging. Default: + default. +--log-file /.log + Set the log file path and filename. Default: data\log\keycloak.log. +--log-file-format + Set a format specific to file log entries. Default: %d{yyyy-MM-dd HH:mm:ss, + SSS} %-5p [%c] (%t) %s%e%n. +--log-level + The log level of the root category or a comma-separated list of individual + categories and their levels. For the root category, you don't need to + specify a category. Default: info. + +You may use the "--auto-build" option when starting the server to avoid running +the "build" command everytime you need to change a static property: + + $ kc.bat start --auto-build + +By doing that you have an additional overhead when the server is starting. Run +"kc.bat build -h" for more details. \ No newline at end of file