Skip to content

Commit

Permalink
CI: fix unit tests for backports
Browse files Browse the repository at this point in the history
  • Loading branch information
SandyXSD committed Feb 3, 2024
1 parent 20e3950 commit d7c2877
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .github/scripts/prepare_db.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash -e

set -x

source .github/scripts/start_meta_engine.sh
[ -z "$TEST" ] && echo "TEST is not set" && exit 1

Expand Down
5 changes: 3 additions & 2 deletions .github/scripts/setup-hdfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
# limitations under the License.
#

set -x
set -e
sudo apt-get update
sudo apt-get install openjdk-8-jdk -y

HADOOP_VERSION="2.10.1"
wget -q https://dlcdn.apache.org/hadoop/common/hadoop-2.10.1/hadoop-2.10.1.tar.gz
HADOOP_VERSION="2.10.2"
wget -q https://dlcdn.apache.org/hadoop/common/hadoop-2.10.2/hadoop-2.10.2.tar.gz
mkdir ~/app
tar -zxf hadoop-${HADOOP_VERSION}.tar.gz -C ~/app

Expand Down
14 changes: 7 additions & 7 deletions pkg/meta/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ func testCompaction(t *testing.T, m Meta, trash bool) {
}

// truncate to 0
if st := m.Truncate(ctx, inode, 0, 0, attr, false); st != 0 {
if st := m.Truncate(ctx, inode, 0, 0, attr); st != 0 {
t.Fatalf("truncate file: %s", st)
}
if c, ok := m.(compactor); ok {
Expand All @@ -950,11 +950,11 @@ func testCompaction(t *testing.T, m Meta, trash bool) {
t.Fatalf("inode %d should be compacted, but have %d slices, size %d", inode, len(slices), slices[0].Len)
}

if st := m.Truncate(ctx, inode, 0, 64<<10, attr, false); st != 0 {
if st := m.Truncate(ctx, inode, 0, 64<<10, attr); st != 0 {
t.Fatalf("truncate file: %s", st)
}
m.NewSlice(ctx, &sliceId)
_ = m.Write(ctx, inode, 0, uint32(1<<20), Slice{Id: sliceId, Size: 2 << 20, Len: 2 << 20}, time.Now())
_ = m.Write(ctx, inode, 0, uint32(1<<20), Slice{Id: sliceId, Size: 2 << 20, Len: 2 << 20})
if c, ok := m.(compactor); ok {
c.compactChunk(inode, 0, true)
}
Expand All @@ -967,12 +967,12 @@ func testCompaction(t *testing.T, m Meta, trash bool) {
}

m.NewSlice(ctx, &sliceId)
_ = m.Write(ctx, inode, 0, uint32(512<<10), Slice{Id: sliceId, Size: 2 << 20, Len: 64 << 10}, time.Now())
_ = m.Write(ctx, inode, 0, uint32(512<<10), Slice{Id: sliceId, Size: 2 << 20, Len: 64 << 10})
m.NewSlice(ctx, &sliceId)
_ = m.Write(ctx, inode, 0, uint32(0), Slice{Id: sliceId, Size: 1 << 20, Len: 64 << 10}, time.Now())
_ = m.Write(ctx, inode, 0, uint32(0), Slice{Id: sliceId, Size: 1 << 20, Len: 64 << 10})
m.NewSlice(ctx, &sliceId)
_ = m.Write(ctx, inode, 0, uint32(128<<10), Slice{Id: sliceId, Size: 2 << 20, Len: 128 << 10}, time.Now())
_ = m.Write(ctx, inode, 0, uint32(0), Slice{Id: 0, Size: 1 << 20, Len: 1 << 20}, time.Now())
_ = m.Write(ctx, inode, 0, uint32(128<<10), Slice{Id: sliceId, Size: 2 << 20, Len: 128 << 10})
_ = m.Write(ctx, inode, 0, uint32(0), Slice{Id: 0, Size: 1 << 20, Len: 1 << 20})
if c, ok := m.(compactor); ok {
c.compactChunk(inode, 0, true)
}
Expand Down

0 comments on commit d7c2877

Please sign in to comment.