Data-AnyXfer

 view release on metacpan or  search on metacpan

t/elastic/serverdict.t  view on Meta::CPAN

use Modern::Perl;

use Test::Most;
use Test::Deep;
use aliased 'Data::AnyXfer::Elastic::ServerDict';

use constant TEST_SERVERS_FILE => './t/data/servers.json';



# Expected values for servers.json test file

my %ExpectedDefinition = (
  name              => 'testserver',
  env               => 'testing',
  silos             => [qw/public_data private_data/],
  standalone_nodes  => [
     'test-es-1.example.com:9200',
     'test-es-2.example.com:9200',
     'test-es-3.example.com:9200'
  ],
  cluster_nodes     => [
      'test-es-1.example.com:9201',
      'test-es-2.example.com:9201',
      'test-es-3.example.com:9201'
  ],
  installed_version => '6.4.0',
);

my %ExpectedDict = (
  server_definitions => ignore(),
  _lookup_cache => {
    node_to_def => ignore(),
    node_to_installed_version => {
      'http://localhost:9200' => '6.4.0',
      'http://localhost:9201' => '6.4.0',
      'http://test-es-1.example.com:9200' => '6.4.0',
      'http://test-es-1.example.com:9201' => '6.4.0',
      'http://test-es-2.example.com:9200' => '6.4.0',
      'http://test-es-2.example.com:9201' => '6.4.0',
      'http://test-es-3.example.com:9200' => '6.4.0',
      'http://test-es-3.example.com:9201' => '6.4.0',
    },
    silo_to_def => {
      production  => [
        noclass(superhashof({ name => 'prodserver' }))
      ],
      public_data => [
        noclass(superhashof({ name => 'prodserver' })),
        noclass(superhashof({ name => 'testserver' }))
      ],
      private_data => [
        noclass(superhashof({ name => 'prodserver' })),
        noclass(superhashof({ name => 'testserver' }))
      ],
      testing => [
        noclass(superhashof({ name => 'testserver' }))
      ]
    },
  },
);



( run in 2.043 seconds using v1.01-cache-2.11-cpan-98e64b0badf )