Exemplo n.º 1
0
        public YamlConfiguration(string configurationFile)
        {
            if (!File.Exists(configurationFile))
            {
                return;
            }

            _config = File.ReadAllLines(configurationFile)
                      .Where(l => !l.Trim().StartsWith("#") && !string.IsNullOrWhiteSpace(l))
                      .ToDictionary(ConfigName, ConfigValue);

            this.Mode = GetTestMode(_config["mode"]);
            this.ElasticsearchVersion = ElasticsearchVersion.From(_config["elasticsearch_version"]);
            this.ForceReseed          = BoolConfig("force_reseed", false);
            this.TestAgainstAlreadyRunningElasticsearch = BoolConfig("test_against_already_running_elasticsearch", false);
            this.ShowElasticsearchOutputAfterStarted    = BoolConfig("elasticsearch_out_after_started", false);
            this.ClusterFilter = _config.ContainsKey("cluster_filter") ? _config["cluster_filter"] : null;
            this.TestFilter    = _config.ContainsKey("test_filter") ? _config["test_filter"] : null;

            this.Seed = _config.TryGetValue("seed", out var seed) ? int.Parse(seed) : 1337;
            var randomizer = new Randomizer(this.Seed);

            this.Random = new RandomConfiguration
            {
                SourceSerializer = RandomBool("source_serializer", randomizer),
                TypedKeys        = RandomBool("typed_keys", randomizer),
                OldConnection    = RandomBool("old_connection", randomizer)
            };
        }
        public EnvironmentConfiguration()
        {
            //if env var NEST_INTEGRATION_VERSION is set assume integration mode
            //used by the build script FAKE
            var version = Environment.GetEnvironmentVariable("NEST_INTEGRATION_VERSION");

            if (!string.IsNullOrEmpty(version))
            {
                Mode = TestMode.Integration;
            }

            this.ElasticsearchVersion = ElasticsearchVersion.From(string.IsNullOrWhiteSpace(version) ? DefaultVersion : version);
            this.ClusterFilter        = Environment.GetEnvironmentVariable("NEST_INTEGRATION_CLUSTER");
            this.TestFilter           = Environment.GetEnvironmentVariable("NEST_TEST_FILTER");

            var newRandom = new Random().Next(1, 100000);

            this.Seed = TryGetEnv("NEST_TEST_SEED", out var seed) ? int.Parse(seed) : newRandom;
            var randomizer = new Randomizer(this.Seed);

            this.Random = new RandomConfiguration
            {
                SourceSerializer = RandomBoolConfig("SOURCESERIALIZER", randomizer),
                TypedKeys        = RandomBoolConfig("TYPEDKEYS", randomizer),
#if FEATURE_HTTPWEBREQUEST
                OldConnection = RandomBoolConfig("OLDCONNECTION", randomizer),
#else
                OldConnection = false
#endif
            };
        }
Exemplo n.º 3
0
        private static ClientTestClusterConfiguration CreateConfiguration()
        {
            var plugins = new List <ElasticsearchPlugin>
            {
                IngestGeoIp,
                IngestAttachment,
                AnalysisKuromoji,
                AnalysisIcu,
                AnalysisPhonetic,
                MapperMurmur3,
            };

            // TODO: temporary until https://github.com/elastic/elasticsearch-net-abstractions/commit/3977ccb6449870fb4f1e6059be960e12ec5e5125 is released
            if (ElasticsearchVersion.From(TestClient.Configuration.ElasticsearchVersion) >= "6.4.0")
            {
                plugins.Add(new ElasticsearchPlugin("analysis-nori", v => v >= "6.4.0"));
            }

            return(new ClientTestClusterConfiguration(plugins.ToArray())
            {
                MaxConcurrency = 4
            });
        }
Exemplo n.º 4
0
 private static bool InRange(string range) => ElasticsearchVersion.From(TestConfiguration.Instance.ElasticsearchVersion).InRange(range);
 public static bool InRange(this TestConfigurationBase configuration, string range) =>
 ElasticsearchVersion.From(configuration.ElasticsearchVersion).InRange(range);