コード例 #1
2
ファイル: manifest_test.go プロジェクト: pombredanne/bar
func Test_Shadow_NewFromBLOB_20M(t *testing.T) {
	bn := fixtures.MakeBLOB(t, 1024*1024*20+5)
	defer fixtures.KillBLOB(bn)

	m, err := fixtures.NewShadowFromFile(bn)
	assert.NoError(t, err)
	assert.Equal(t, fixtures.FixStream(`BAR:MANIFEST

	id 9e39ad7cf632a038a5a2e0f9144f6ea4aff04ff11803c169cb24f60e56444f08
	size 20971525


	id 1d0debc4d598f7dc39cb53fb5e5ace3e310316231361bba6ef91e834cadd54f6
	size 2097152
	offset 0

	id a3ab965376a5e20a9b15a456ec9400cb16bd2c2570f2a0d53e249ea864307fbe
	size 2097152
	offset 2097152

	id 19493ebb0566afa93c72f0d4eaad59fa5f0326b57f4479e3a37a5d71af52e736
	size 2097152
	offset 4194304

	id c629e80e2205bfa680e0946a4fe4ac20ccb64c7b394d6486dcf1310f4b5dd9b6
	size 2097152
	offset 6291456

	id a6763718c0d3ef294d41c0c8ebe674ee2dac8432290aee1ff4d5e06bed33ad1c
	size 2097152
	offset 8388608

	id 48fb6b5457ce34099ce4f792519c3bc0d0cbdae006b8fc48e9d28850c07cd3fc
	size 2097152
	offset 10485760

	id e31ac3259e3ff446cc9a9e800104fa9d5f5cd74732bae954a6c52a718c4f5a58
	size 2097152
	offset 12582912

	id 4ff1c7f4d3b2c1ba53d2fa853b0b41af0faa9ce0e10e3c7bca9617eb48340af4
	size 2097152
	offset 14680064

	id beb0c46be81961250d2f84392bec70332d6cfa95011c29fa5d1cc176b5aa4feb
	size 2097152
	offset 16777216

	id cc50781f234ed5c6c7b337ec900491b5d8bb765c5769e1836c00e9ec0e43ce6b
	size 2097152
	offset 18874368

	id d9dc02c791744ee3db07776c1a149030c925ff2717ac07bde1fd10da475ac7e6
	size 5
	offset 20971520
	`), (*m).String())
}
コード例 #2
1
ファイル: manifest_test.go プロジェクト: pombredanne/bar
func Test_Shadow_NewFromBLOB_3b(t *testing.T) {
	bn := fixtures.MakeBLOB(t, 3)
	defer fixtures.KillBLOB(bn)

	m, err := fixtures.NewShadowFromFile(bn)
	assert.NoError(t, err)
	assert.Equal(t, fixtures.FixStream(`BAR:MANIFEST

		id 1186d49a4ad620618f760f29da2c593b2ec2cc2ced69dc16817390d861e62253
		size 3


		id 1186d49a4ad620618f760f29da2c593b2ec2cc2ced69dc16817390d861e62253
		size 3
		offset 0
		`), (*m).String())
}
コード例 #3
1
ファイル: manifest_test.go プロジェクト: pombredanne/bar
func Test_Shadow_NewFromBLOB_2K(t *testing.T) {
	bn := fixtures.MakeBLOB(t, 1024*2)
	defer fixtures.KillBLOB(bn)

	m, err := fixtures.NewShadowFromFile(bn)
	assert.NoError(t, err)
	assert.Equal(t, fixtures.FixStream(`BAR:MANIFEST

		id be4215176932949d887fa82241bbe0b03a44dc16ee2d23eedbc973e511ae8bb2
		size 2048


		id be4215176932949d887fa82241bbe0b03a44dc16ee2d23eedbc973e511ae8bb2
		size 2048
		offset 0
		`), (*m).String())
}
コード例 #4
0
ファイル: manifest_test.go プロジェクト: pombredanne/bar
func Benchmark_Manifest_NewFromBLOB_500MB(b *testing.B) {
	b.Skip()
	bn, err := fixtures.MakeBLOBPure(1024 * 1024 * 500)
	if err != nil {
		b.Fail()
	}
	defer fixtures.KillBLOB(bn)

	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		_, _ = fixtures.NewShadowFromFile(bn)
	}
}
コード例 #5
0
ファイル: manifest_test.go プロジェクト: pombredanne/bar
func Test_Shadow_NewFromBLOB_2M(t *testing.T) {
	bn := fixtures.MakeBLOB(t, 1024*1024*2+467)
	defer fixtures.KillBLOB(bn)

	m, err := fixtures.NewShadowFromFile(bn)
	assert.NoError(t, err)
	assert.Equal(t, fixtures.FixStream(`BAR:MANIFEST

	id fd76eb2f9866a12c6c3a2f884d5350b38319bc510106a7ba78789cc5507158b8
	size 2097619


	id 1d0debc4d598f7dc39cb53fb5e5ace3e310316231361bba6ef91e834cadd54f6
	size 2097152
	offset 0

	id 10c1a5bf6dee30935c0528049c4ccea0fa7f7d9d4d50fd361470b0affb0553f4
	size 467
	offset 2097152
	`), (*m).String())
}
コード例 #6
0
ファイル: git_test.go プロジェクト: pombredanne/bar
func Test_Git_Divert1(t *testing.T) {

	tree := fixtures.NewTree("Git_divert", "")
	assert.NoError(t, tree.Populate())
	defer tree.Squash()

	g, err := gitFixture(tree)
	assert.NoError(t, err)

	//	logx.SetLevel(logx.TRACE)

	// get blobmap for further checks
	mod, err := model.New(tree.CWD, false, proto.CHUNK_SIZE, 16)
	assert.NoError(t, err)

	names := lists.NewFileList().ListDir(tree.CWD)
	mans1, err := mod.FeedManifests(true, true, true, names...)
	assert.NoError(t, err)

	// Run divert on "in-other" and "one"
	divert := git.NewDivert(g)
	spec, err := divert.PrepareBegin("other", "in-other", "one", "two/file-four with spaces.bin")
	assert.NoError(t, err)
	err = divert.Begin(spec)
	assert.NoError(t, err)

	// Make two blobs and collect their manifests
	bn1 := filepath.Join(tree.CWD, "in-other", "blob.bin")
	bn2 := filepath.Join(tree.CWD, "one", "file-one.bin")
	fixtures.MakeNamedBLOB(bn1, 110)
	fixtures.MakeNamedBLOB(bn2, 200)

	oMan1, err := fixtures.NewShadowFromFile(bn1)
	assert.NoError(t, err)
	oMan2, err := fixtures.NewShadowFromFile(bn2)
	assert.NoError(t, err)

	// commit
	spec1, err := divert.ReadSpec()
	assert.NoError(t, err)

	err = divert.Commit(spec1, "from-master")
	assert.NoError(t, err)

	err = divert.Cleanup(spec1)
	assert.NoError(t, err)

	err = divert.CleanSpec()
	assert.NoError(t, err)

	// Final checks
	branch, _, err := g.GetBranches()
	assert.NoError(t, err)
	assert.Equal(t, "master", branch)

	// check master files
	names = lists.NewFileList().ListDir(tree.CWD)
	mans2, err := mod.FeedManifests(true, true, true, names...)
	assert.NoError(t, err)
	assert.EqualValues(t, mans1, mans2)

	// check stored branch
	err = g.Checkout("other")
	assert.NoError(t, err)

	oMan1p, err := fixtures.NewShadowFromFile(bn1)
	assert.NoError(t, err)
	assert.EqualValues(t, oMan1, oMan1p)

	oMan2p, err := fixtures.NewShadowFromFile(bn2)
	assert.NoError(t, err)
	assert.EqualValues(t, oMan2, oMan2p)
}