<commit_before><commit_msg>appliance/redis: add dump/restore integration test<commit_after>package main

import (
	"path/filepath"

	c "github.com/flynn/flynn/Godeps/_workspace/src/github.com/flynn/go-check"
)

type RedisSuite struct {
	Helper
}

var _ = c.ConcurrentSuite(&RedisSuite{})

func (s *RedisSuite) TestDumpRestore(t *c.C) {
	r := s.newGitRepo(t, "empty")
	t.Assert(r.flynn("create"), Succeeds)

	t.Assert(r.flynn("resource", "add", "redis"), Succeeds)

	t.Assert(r.flynn("redis", "redis-cli", "set", "foo", "bar"), Succeeds)

	file := filepath.Join(t.MkDir(), "dump.rdb")
	t.Assert(r.flynn("redis", "dump", "-f", file), Succeeds)
	t.Assert(r.flynn("redis", "redis-cli", "del", "foo"), Succeeds)

	r.flynn("redis", "restore", "-f", file)

	query := r.flynn("redis", "redis-cli", "get", "foo")
	t.Assert(query, SuccessfulOutputContains, "bar")
}
{'fraction_non_alphanumeric': 0.2152046783625731, 'fraction_numerical': 0.0, 'mean_word_length': 5.43609022556391, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4637347', 'n_tokens_mistral': 367, 'n_tokens_neox': 358, 'n_words': 61}