Fix bad annotations

This commit is contained in:
Darko Brdareski
2021-12-13 13:41:04 +01:00
parent 5065626984
commit 0addca1070
40 changed files with 232 additions and 249 deletions
-5
View File
@@ -45,12 +45,10 @@ func TestImportLocal(t *testing.T) {
b, err := testdata.ReadFile("testdata/payload.txt")
require.NoError(t, err)
//stm: @CLIENT_IMPORT_003
root, err := a.ClientImportLocal(ctx, bytes.NewReader(b))
require.NoError(t, err)
require.NotEqual(t, cid.Undef, root)
//stm: @CLIENT_IMPORT_004
list, err := a.ClientListImports(ctx)
require.NoError(t, err)
require.Len(t, list, 1)
@@ -71,7 +69,6 @@ func TestImportLocal(t *testing.T) {
// retrieve as UnixFS.
out1 := filepath.Join(dir, "retrieval1.data") // as unixfs
out2 := filepath.Join(dir, "retrieval2.data") // as car
//stm: @CLIENT_IMPORT_005
err = a.ClientRetrieve(ctx, order, &api.FileRef{
Path: out1,
})
@@ -88,7 +85,6 @@ func TestImportLocal(t *testing.T) {
require.NoError(t, err)
// open the CARv2 being custodied by the import manager
//stm: @CLIENT_IMPORT_006
orig, err := carv2.OpenReader(it.CARPath)
require.NoError(t, err)
@@ -99,7 +95,6 @@ func TestImportLocal(t *testing.T) {
require.EqualValues(t, 1, exported.Version)
require.EqualValues(t, 2, orig.Version)
//stm: @CLIENT_IMPORT_007
origRoots, err := orig.Roots()
require.NoError(t, err)
require.Len(t, origRoots, 1)
-6
View File
@@ -36,13 +36,11 @@ func TestRoundtripUnixFS_Dense(t *testing.T) {
defer os.Remove(carv2File) //nolint:errcheck
// import a file to a Unixfs DAG using a CARv2 read/write blockstore.
//stm: @CLIENT_IMPORT_001, @CLIENT_BLOCKSTORE_001
bs, err := blockstore.OpenReadWrite(carv2File, nil,
carv2.ZeroLengthSectionAsEOF(true),
blockstore.UseWholeCIDs(true))
require.NoError(t, err)
//stm: @CLIENT_IMPORT_001
root, err := buildUnixFS(ctx, bytes.NewBuffer(inputContents), bs, false)
require.NoError(t, err)
require.NotEqual(t, cid.Undef, root)
@@ -88,13 +86,11 @@ func TestRoundtripUnixFS_Filestore(t *testing.T) {
dst := newTmpFile(t)
defer os.Remove(dst) //nolint:errcheck
//stm: @CLIENT_FS_001
root, err := a.createUnixFSFilestore(ctx, inputPath, dst)
require.NoError(t, err)
require.NotEqual(t, cid.Undef, root)
// convert the CARv2 to a normal file again and ensure the contents match
//stm: @CLIENT_FS_002
fs, err := stores.ReadOnlyFilestore(dst)
require.NoError(t, err)
defer fs.Close() //nolint:errcheck
@@ -121,7 +117,6 @@ func TestRoundtripUnixFS_Filestore(t *testing.T) {
}
func newTmpFile(t *testing.T) string {
//stm: @CLIENT_FS_003
f, err := os.CreateTemp("", "")
require.NoError(t, err)
require.NoError(t, f.Close())
@@ -129,7 +124,6 @@ func newTmpFile(t *testing.T) string {
}
func genInputFile(t *testing.T) (filepath string, contents []byte) {
//stm: @CLIENT_FS_004
s := strings.Repeat("abcde", 100)
tmp, err := os.CreateTemp("", "")
require.NoError(t, err)
+1 -1
View File
@@ -13,7 +13,7 @@ import (
)
func TestMedian(t *testing.T) {
//stm: @REPO_GAS_001
GAS_001
require.Equal(t, types.NewInt(5), medianGasPremium([]GasMeta{
{big.NewInt(5), build.BlockGasTarget},
}, 1))