Пример #1
0
        public void BootSettings_DownloadConfigOverridesEnvVars()
        {
            // 0. Setup
            TestLogger logger = new TestLogger();

            using (EnvironmentVariableScope envScope = new EnvironmentVariableScope())
            {
                AppConfigWrapper configScope = new AppConfigWrapper();

                envScope.SetVariable(BootstrapperSettings.SQAnalysisRootPath, "env download dir");
                configScope.SetDownloadDir("config download dir");

                // 1. Check the config scope takes precedence
                IBootstrapperSettings settings = new BootstrapperSettings(logger, configScope.AppConfig);
                AssertExpectedDownloadDir(@"config download dir", settings);

                // 2. Now clear the config scope and check the env var is used
                configScope.Reset();
                settings = new BootstrapperSettings(logger);
                AssertExpectedDownloadDir(@"env download dir\sqtemp\bin", settings);
            }
        }
Пример #2
0
        public void BootSettings_ConfigOverridesPropertiesFile_Url()
        {
            // 0. Setup
            TestLogger logger = new TestLogger();

            using (EnvironmentVariableScope envScope = new EnvironmentVariableScope())
            {
                string runnerBinDir = CreateSonarRunnerFiles("http://envUrl");
                envScope.SetPath(runnerBinDir); // so the properties file can be found

                AppConfigWrapper configScope = new AppConfigWrapper();
                configScope.SetSonarQubeUrl("http://configUrl");

                // 1. Check the config scope takes precedence
                IBootstrapperSettings settings = new BootstrapperSettings(logger, configScope.AppConfig);
                AssertExpectedServerUrl(@"http://configUrl", settings);

                // 2. Now clear the config scope and check the env var is used
                configScope.Reset();
                settings = new BootstrapperSettings(logger);
                AssertExpectedServerUrl(@"http://envUrl", settings);
            }
        }