package s3

import (
	"testing"

	"github.com/rlmcpherson/s3gof3r"
	"polydawn.net/repeatr/input/tests"
	"polydawn.net/repeatr/lib/guid"
	"polydawn.net/repeatr/output/s3"
)

func TestCoreCompliance(t *testing.T) {
	if _, err := s3gof3r.EnvKeys(); err != nil {
		t.Skipf("skipping s3 output tests; no s3 credentials loaded (err: %s)", err)
	}

	// group all effects of this test run under one "dir" for human reader sanity and cleanup in extremis.
	testRunGuid := guid.New()

	tests.CheckRoundTrip(t, "s3", s3.New, New, "s3://repeatr-test/test-"+testRunGuid+"/rt/obj.tar")
}

package s3

import (
	"testing"

	"github.com/rlmcpherson/s3gof3r"
	"polydawn.net/repeatr/input/tests"
	"polydawn.net/repeatr/lib/guid"
	"polydawn.net/repeatr/output/s3"
)

func TestCoreCompliance(t *testing.T) {
	if _, err := s3gof3r.EnvKeys(); err != nil {
		t.Skipf("skipping s3 output tests; no s3 credentials loaded (err: %s)", err)
	}

	// group all effects of this test run under one "dir" for human reader sanity and cleanup in extremis.
	testRunGuid := guid.New()

	tests.CheckRoundTrip(t, "s3", s3.New, New, "s3://repeatr-test/test-"+testRunGuid+"/rt/obj.tar")
	tests.CheckRoundTrip(t, "s3", s3.New, New, "s3+splay://repeatr-test/test-"+testRunGuid+"/rt-splay/heap/")
}

Add test of s3 splay URIs: CA-storage under prefix
Add test of s3 splay URIs: CA-storage under prefix

Using the URI scheme to indicate a "splay" mode causes the s3 input and output systems to save data under content-addressible hashes (prefixed by a selected path) -- this allows easily storing sets of data under a single URI.

(A better test would shovel several datasets into the same prefix at once, and then make sure they're all uniquely still reachable... this should be worked into the common tests in the future.)

Signed-off-by: Eric Myhre <2346ad27d7568ba9896f1b7da6b5991251debdf2@exultant.us>
