Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(e2e-523): inital commit - fixing e2e/system tests - WIP #535

Merged
merged 27 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6027c57
fix(e2e-523): inital commit - fixing tests
tty47 Aug 6, 2024
6af8480
fix(e2e-523): inital commit - fixing tests
tty47 Aug 6, 2024
69ff770
fix(e2e-523): inital commit - fixing tests
tty47 Aug 6, 2024
d90ac8f
fix(e2e-523): update s.T().Fatalf to s.Require()
tty47 Aug 7, 2024
872db19
fix(e2e-523): update s.T().Fatalf to s.Require()
tty47 Aug 7, 2024
f99699b
fix(e2e-523): update s.T().Fatalf to s.Require()
tty47 Aug 7, 2024
1dd6415
Merge branch 'main' into jose/test-folders-errors
mojtaba-esk Aug 12, 2024
041d471
chore: conflict resolve & some cleanup
mojtaba-esk Aug 12, 2024
98796b7
fix: linter complains
mojtaba-esk Aug 12, 2024
1bc549f
fix: minio concurrent bucket creation request issue
mojtaba-esk Aug 12, 2024
b2a8e98
fix: map init
mojtaba-esk Aug 12, 2024
03b5b5f
fix: kaniko concurrency overwriting issue
mojtaba-esk Aug 12, 2024
ba23bc9
chore: improve error propagation
mojtaba-esk Aug 13, 2024
8373c9d
fix: image cache issue fixed
mojtaba-esk Aug 16, 2024
845f7a9
fix: failing test suits removed problematic code
mojtaba-esk Aug 19, 2024
cd946d2
chore: increase system test timeout
mojtaba-esk Aug 19, 2024
9039336
chore: fix tests to be executed in parallel
mojtaba-esk Aug 19, 2024
83b02ab
chore: increase timeout to be on the safeside
mojtaba-esk Aug 20, 2024
05f32d1
chore: increase timeout to be on the safeside in the ci
mojtaba-esk Aug 20, 2024
f9d538f
chore: fixed the premature cleanup
mojtaba-esk Aug 20, 2024
29c4bba
chore: testing 60 min timeout
mojtaba-esk Aug 21, 2024
844acfc
fix: the deadlock issue in test suit
mojtaba-esk Aug 21, 2024
50e1ce1
chore: cleanup
mojtaba-esk Aug 21, 2024
6caa339
chore: fixed the missing cleanup
mojtaba-esk Aug 21, 2024
0c14000
chore: applied changes
mojtaba-esk Aug 22, 2024
de3fa64
chore: revert deletion of TestNoVolumesNoFiles
mojtaba-esk Aug 22, 2024
83a204a
Merge branch 'main' into jose/test-folders-errors
mojtaba-esk Aug 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/knuu_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- pkg: "./e2e/basic"
timeout: 15m
- pkg: "./e2e/system"
timeout: 15m
timeout: 60m
- pkg: "./e2e/netshaper"
timeout: 60m
runs-on: ubuntu-latest
Expand Down
6 changes: 0 additions & 6 deletions e2e/basic/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ func (ts *TestSuite) TestBasic() {
ts.Require().NoError(target.Build().SetStartCommand("sleep", "infinity"))
ts.Require().NoError(target.Build().Commit(ctx))

ts.T().Cleanup(func() {
if err := target.Execution().Destroy(ctx); err != nil {
ts.T().Logf("error destroying instance: %v", err)
}
})

// Test Logic
ts.Require().NoError(target.Execution().Start(ctx))

Expand Down
33 changes: 0 additions & 33 deletions e2e/netshaper/netshaper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"strconv"
"time"

"github.com/celestiaorg/knuu/pkg/instance"
"github.com/celestiaorg/knuu/pkg/sidecars/netshaper"
)

Expand Down Expand Up @@ -47,14 +46,6 @@ func (s *Suite) TestNetShaperBandwidth() {
btSidecar := netshaper.New()
s.Require().NoError(iperfServer.Sidecars().Add(ctx, btSidecar))

s.T().Cleanup(func() {
s.T().Log("Tearing down TestNetShaperBandwidth test...")
err := instance.BatchDestroy(ctx, iperfServer, iperfClient)
if err != nil {
s.T().Logf("error destroying instances: %v", err)
}
})

// Prepare iperf client & server

s.Require().NoError(iperfServer.Execution().Start(ctx))
Expand Down Expand Up @@ -156,14 +147,6 @@ func (s *Suite) TestNetShaperPacketloss() {
executor, err := mother.CloneWithName("executor")
s.Require().NoError(err)

s.T().Cleanup(func() {
s.T().Log("Tearing down TestNetShaperPacketloss test...")
err := instance.BatchDestroy(ctx, executor, target)
if err != nil {
s.T().Logf("error destroying instances: %v", err)
}
})

// Prepare ping executor & target

s.Require().NoError(target.Execution().Start(ctx))
Expand Down Expand Up @@ -259,14 +242,6 @@ func (s *Suite) TestNetShaperLatency() {
executor, err := mother.CloneWithName("executor")
s.Require().NoError(err)

s.T().Cleanup(func() {
s.T().Log("Tearing down TestNetShaperLatency test...")
err := instance.BatchDestroy(ctx, executor, target)
if err != nil {
s.T().Logf("error destroying instances: %v", err)
}
})

// Prepare ping executor & target

s.Require().NoError(target.Execution().Start(ctx))
Expand Down Expand Up @@ -369,14 +344,6 @@ func (s *Suite) TestNetShaperJitter() {
executor, err := mother.CloneWithName("executor")
s.Require().NoError(err)

s.T().Cleanup(func() {
s.T().Log("Tearing down TestNetShaperJitter test...")
err := instance.BatchDestroy(ctx, executor, target)
if err != nil {
s.T().Logf("error destroying instances: %v", err)
}
})

// Prepare ping executor & target

s.Require().NoError(target.Execution().Start(ctx))
Expand Down
75 changes: 40 additions & 35 deletions e2e/system/build_from_git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,85 +7,90 @@ import (
"github.com/celestiaorg/knuu/pkg/builder"
)

const (
gitRepo = "https://github.com/celestiaorg/knuu.git"
gitBranch = "test/build-from-git" // This branch has a Dockerfile and is protected as to not be deleted
)

func (s *Suite) TestBuildFromGit() {
const namePrefix = "build-from-git"
s.T().Parallel()

// Setup
ctx := context.Background()

s.T().Log("Creating new instance")
target, err := s.Knuu.NewInstance(namePrefix)
s.Require().NoError(err)
s.Require().NoError(err, "Error creating new instance")

s.T().Log("Building the image")

// This is a blocking call which builds the image from git repo
err = target.Build().SetGitRepo(ctx, builder.GitContext{
Repo: "https://github.com/celestiaorg/knuu.git",
Branch: "test/build-from-git", // This branch has a Dockerfile and is protected as to not be deleted
Repo: gitRepo,
Branch: gitBranch,
Username: "",
Password: "",
})
s.Require().NoError(err)

s.Require().NoError(err, "Error setting git repo")
s.T().Log("Image built")

s.T().Cleanup(func() {
if err := target.Execution().Destroy(ctx); err != nil {
s.T().Logf("Error cleaning up knuu: %v", err)
}
})

s.Require().NoError(target.Build().Commit(ctx))

s.T().Logf("Starting instance")
s.Require().NoError(target.Execution().Start(ctx))

s.T().Logf("Instance started")
s.T().Log("Instance started")

s.T().Log("Getting file bytes")
// The file is created by the dockerfile in the repo,
// so to make sure it is built correctly, we check the file
data, err := target.Storage().GetFileBytes(ctx, "/test.txt")
s.Require().NoError(err)

data = []byte(strings.TrimSpace(string(data)))
s.Assert().Equal([]byte("Hello, World!"), data, "File bytes do not match")
s.Assert().Equal([]byte("Hello, World!"), data, "file bytes do not match.")
}

func (s *Suite) TestBuildFromGitWithModifications() {
const namePrefix = "build-from-git-with-modifications"
s.T().Parallel()
const (
namePrefix = "build-from-git-with-modifications"
maxRetries = 3
)

// Setup
ctx := context.Background()

s.T().Log("Creating new instance")
target, err := s.Knuu.NewInstance(namePrefix)
s.Require().NoError(err)

ctx := context.Background()
// This is a blocking call which builds the image from git repo
err = target.Build().SetGitRepo(ctx, builder.GitContext{
Repo: "https://github.com/celestiaorg/knuu.git",
Branch: "test/build-from-git", // This branch has a Dockerfile and is protected as to not be deleted
Username: "",
Password: "",
})
s.T().Log("Setting git repo")
err = s.retryOperation(func() error {
return target.Build().SetGitRepo(ctx, builder.GitContext{
Repo: gitRepo,
Branch: gitBranch,
Username: "",
Password: "",
})
}, maxRetries)
s.Require().NoError(err)

s.Require().NoError(target.Build().SetStartCommand("sleep", "infinity"))

err = target.Storage().AddFileBytes([]byte("Hello, world!"), "/home/hello.txt", "root:root")
s.Require().NoError(err, "Error adding file")
const (
filePath = "/home/hello.txt"
expectedData = "Hello, world!"
)

s.Require().NoError(target.Build().Commit(ctx))
err = target.Storage().AddFileBytes([]byte(expectedData), filePath, "root:root")
s.Require().NoError(err)

s.T().Cleanup(func() {
if err := target.Execution().Destroy(ctx); err != nil {
s.T().Logf("Error cleaning up knuu: %v", err)
}
})
s.Require().NoError(target.Build().Commit(ctx))

s.Require().NoError(target.Execution().Start(ctx))

data, err := target.Storage().GetFileBytes(ctx, "/home/hello.txt")
s.Require().NoError(err, "Error getting file bytes")
gotData, err := target.Storage().GetFileBytes(ctx, filePath)
s.Require().NoError(err)

s.Assert().Equal([]byte("Hello, world!"), data, "File bytes do not match")
s.Assert().Equal([]byte(expectedData), gotData, "file bytes do not match.")
}
10 changes: 0 additions & 10 deletions e2e/system/env_to_json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ func (s *Suite) TestEnvToJSON() {
numberOfInstances = 2
)

s.T().Parallel()

// Setup
ctx := context.Background()
executor, err := s.Executor.NewInstance(ctx, namePrefix+"-executor")
Expand Down Expand Up @@ -61,14 +59,6 @@ func (s *Suite) TestEnvToJSON() {
instances[i] = ins
}

s.T().Cleanup(func() {
all := append(instances, executor)
err := instance.BatchDestroy(ctx, all...)
if err != nil {
s.T().Logf("error destroying instances: %v", err)
}
})

// Test logic
for _, i := range instances {
webIP, err := i.Network().GetIP(ctx)
Expand Down
10 changes: 0 additions & 10 deletions e2e/system/external_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ import (
"io"
"os"
"path/filepath"

"github.com/celestiaorg/knuu/pkg/instance"
)

func (s *Suite) TestExternalFile() {
const namePrefix = "external-file"
s.T().Parallel()
// Setup

ctx := context.Background()
Expand Down Expand Up @@ -43,13 +40,6 @@ func (s *Suite) TestExternalFile() {

s.Require().NoError(server.Build().Commit(ctx))

s.T().Cleanup(func() {
err := instance.BatchDestroy(ctx, executor, server)
if err != nil {
s.T().Logf("error destroying instance: %v", err)
}
})

// Test logic
serverIP, err := server.Network().GetIP(ctx)
s.Require().NoError(err)
Expand Down
Loading
Loading