This commit is contained in:
Robert Muir 2015-12-21 17:02:50 -05:00
parent b8524bdb11
commit 5ebcf183e5
6 changed files with 138 additions and 22 deletions

View File

@ -15,8 +15,10 @@
- match: { nodes.$master.plugins.0.name: repository-hdfs } - match: { nodes.$master.plugins.0.name: repository-hdfs }
- match: { nodes.$master.plugins.0.jvm: true } - match: { nodes.$master.plugins.0.jvm: true }
--- ---
#
# Check that we can't use file:// repositories or anything like that # Check that we can't use file:// repositories or anything like that
# We only test this plugin against hdfs:// # We only test this plugin against hdfs://
#
"HDFS only": "HDFS only":
- do: - do:
catch: /Invalid scheme/ catch: /Invalid scheme/

View File

@ -2,20 +2,26 @@
# #
# Tests creating a repository # Tests creating a repository
# #
"HDFS Repository Config": "HDFS Repository Creation":
# Create repository
- do: - do:
snapshot.create_repository: snapshot.create_repository:
repository: test_repo_hdfs_1 repository: test_repository_create
body: body:
type: hdfs type: hdfs
settings: settings:
uri: "hdfs://localhost:9999" uri: "hdfs://localhost:9999"
path: "foo/bar" path: "test/repository_create"
# Get repository # Get repository
- do: - do:
snapshot.get_repository: snapshot.get_repository:
repository: test_repo_hdfs_1 repository: test_repository_create
- is_true: test_repo_hdfs_1 - is_true: test_repository_create
- match: {test_repo_hdfs_1.settings.path : "foo/bar"} - match: {test_repository_create.settings.path : "test/repository_create"}
# Remove our repository
- do:
snapshot.delete_repository:
repository: test_repository_create

View File

@ -0,0 +1,23 @@
# Integration tests for HDFS Repository plugin
#
# Tests explicit verify
#
"HDFS Repository Verify":
- do:
snapshot.create_repository:
repository: test_repository_verify
body:
type: hdfs
settings:
uri: "hdfs://localhost:9999"
path: "test/repository_verify"
# Verify repository
- do:
snapshot.verify_repository:
repository: test_repository_verify
# Remove our repository
- do:
snapshot.delete_repository:
repository: test_repository_verify

View File

@ -3,17 +3,18 @@
# Actually perform a snapshot to hdfs # Actually perform a snapshot to hdfs
# #
--- ---
setup: "take snapshot":
# Create repository
- do: - do:
snapshot.create_repository: snapshot.create_repository:
repository: test_repo_hdfs_snapshot repository: test_snapshot_repository
body: body:
type: hdfs type: hdfs
settings: settings:
uri: "hdfs://localhost:9999" uri: "hdfs://localhost:9999"
path: "foo/bar" path: "test/snapshot"
# Create index
- do: - do:
indices.create: indices.create:
index: test_index index: test_index
@ -22,16 +23,15 @@ setup:
number_of_shards: 1 number_of_shards: 1
number_of_replicas: 1 number_of_replicas: 1
# Wait for yellow
- do: - do:
cluster.health: cluster.health:
wait_for_status: yellow wait_for_status: yellow
--- # Create snapshot
"Create a snapshot":
- do: - do:
snapshot.create: snapshot.create:
repository: test_repo_hdfs_snapshot repository: test_snapshot_repository
snapshot: test_snapshot snapshot: test_snapshot
wait_for_completion: true wait_for_completion: true
@ -40,3 +40,14 @@ setup:
- match: { snapshot.shards.successful: 1 } - match: { snapshot.shards.successful: 1 }
- match: { snapshot.shards.failed : 0 } - match: { snapshot.shards.failed : 0 }
# Remove our snapshot
- do:
snapshot.delete:
repository: test_snapshot_repository
snapshot: test_snapshot
# Remove our repository
- do:
snapshot.delete_repository:
repository: test_snapshot_repository

View File

@ -0,0 +1,60 @@
# Integration tests for HDFS Repository plugin
#
# Tests retrieving information about snapshot
#
---
"Get a snapshot":
# Create repository
- do:
snapshot.create_repository:
repository: test_snapshot_get_repository
body:
type: hdfs
settings:
uri: "hdfs://localhost:9999"
path: "test/snapshot_get"
# Create index
- do:
indices.create:
index: test_index
body:
settings:
number_of_shards: 1
number_of_replicas: 0
# Wait for green
- do:
cluster.health:
wait_for_status: green
# Create snapshot
- do:
snapshot.create:
repository: test_snapshot_get_repository
snapshot: test_snapshot_get
wait_for_completion: true
- match: { snapshot.snapshot: test_snapshot_get }
- match: { snapshot.state : SUCCESS }
- match: { snapshot.shards.successful: 1 }
- match: { snapshot.shards.failed : 0 }
# Get snapshot info
- do:
snapshot.get:
repository: test_snapshot_get_repository
snapshot: test_snapshot_get
- match: { snapshots.0.snapshot : test_snapshot_get }
# Remove our snapshot
- do:
snapshot.delete:
repository: test_snapshot_get_repository
snapshot: test_snapshot_get
# Remove our repository
- do:
snapshot.delete_repository:
repository: test_snapshot_get_repository

View File

@ -3,17 +3,19 @@
# Actually perform a snapshot to hdfs, then restore it # Actually perform a snapshot to hdfs, then restore it
# #
--- ---
setup: "Create a snapshot and then restore it":
# Create repository
- do: - do:
snapshot.create_repository: snapshot.create_repository:
repository: test_repo_hdfs_restore repository: test_restore_repository
body: body:
type: hdfs type: hdfs
settings: settings:
uri: "hdfs://localhost:9999" uri: "hdfs://localhost:9999"
path: "foo/bar" path: "test/restore"
# Create index
- do: - do:
indices.create: indices.create:
index: test_index index: test_index
@ -22,16 +24,15 @@ setup:
number_of_shards: 1 number_of_shards: 1
number_of_replicas: 0 number_of_replicas: 0
# Wait for green
- do: - do:
cluster.health: cluster.health:
wait_for_status: green wait_for_status: green
--- # Take snapshot
"Create a snapshot and then restore it":
- do: - do:
snapshot.create: snapshot.create:
repository: test_repo_hdfs_restore repository: test_restore_repository
snapshot: test_restore snapshot: test_restore
wait_for_completion: true wait_for_completion: true
@ -42,16 +43,19 @@ setup:
- is_true: snapshot.version - is_true: snapshot.version
- gt: { snapshot.version_id: 0} - gt: { snapshot.version_id: 0}
# Close index
- do: - do:
indices.close: indices.close:
index : test_index index : test_index
# Restore index
- do: - do:
snapshot.restore: snapshot.restore:
repository: test_repo_hdfs_restore repository: test_restore_repository
snapshot: test_restore snapshot: test_restore
wait_for_completion: true wait_for_completion: true
# Check recovery stats
- do: - do:
indices.recovery: indices.recovery:
index: test_index index: test_index
@ -63,3 +67,13 @@ setup:
- match: { test_index.shards.0.index.files.reused: 0} - match: { test_index.shards.0.index.files.reused: 0}
- match: { test_index.shards.0.index.size.reused_in_bytes: 0} - match: { test_index.shards.0.index.size.reused_in_bytes: 0}
# Remove our snapshot
- do:
snapshot.delete:
repository: test_restore_repository
snapshot: test_restore
# Remove our repository
- do:
snapshot.delete_repository:
repository: test_restore_repository