Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Commit

Permalink
refac: Update mock-avs version number and handling
Browse files Browse the repository at this point in the history
  • Loading branch information
AntiD2ta committed Sep 14, 2023
1 parent 8d7d0ae commit 1073ef9
Show file tree
Hide file tree
Showing 13 changed files with 158 additions and 147 deletions.
1 change: 1 addition & 0 deletions cli/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ the user to know which options are available for each profile.
}

instanceId, err := d.Install(daemon.InstallOptions{
Name: pullResult.Name,
URL: url,
Version: pullResult.Version,
SpecVersion: pullResult.SpecVersion,
Expand Down
11 changes: 11 additions & 0 deletions e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ import (
"testing"
)

const (
mockAVSRepo = "https://github.com/NethermindEth/mock-avs"
mockAVSPkgRepo = "https://github.com/NethermindEth/mock-avs-pkg"
latestMockAVSVersion = "v0.1.0"
latestMockAVSPkgVersion = "v5.4.0"
latestMockAVSCommitHash = "b64c50c15e53ae7afebbdbe210b834d1ee471043"
optionReturnerImage = "mock-avs-option-returner:" + latestMockAVSVersion
healthCheckerImage = "mock-avs-health-checker:" + latestMockAVSVersion
pluginImage = "mock-avs-plugin:" + latestMockAVSVersion
)

type (
e2eArranger func(t *testing.T, eigenlayerPath string) error
e2eAct func(t *testing.T, eigenlayerPath string)
Expand Down
36 changes: 15 additions & 21 deletions e2e/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ import (
"github.com/stretchr/testify/require"
)

const (
mockAVSRepo = "https://github.com/NethermindEth/mock-avs-pkg"
latestMockAVSVersion = "v5.4.0"
latestMockAVSCommitHash = "a7ca2dca2cc9a91cdab8f30c2daf86a5f2dc4c55"
)

func TestInstall_WithoutArguments(t *testing.T) {
// Test context
var (
Expand Down Expand Up @@ -52,7 +46,7 @@ func TestInstall_ValidArgument(t *testing.T) {
},
// Act
func(t *testing.T, egnPath string) {
runErr = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--yes", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
runErr = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--yes", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
},
// Assert
func(t *testing.T) {
Expand Down Expand Up @@ -82,7 +76,7 @@ func TestInstall_FromCommitHash(t *testing.T) {
},
// Act
func(t *testing.T, egnPath string) {
runErr = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--yes", "--commit", latestMockAVSCommitHash, mockAVSRepo)
runErr = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--yes", "--commit", latestMockAVSCommitHash, mockAVSPkgRepo)
},
// Assert
func(t *testing.T) {
Expand Down Expand Up @@ -119,7 +113,7 @@ func TestInstall_ValidArgumentWithMonitoring(t *testing.T) {
},
// Act
func(t *testing.T, egnPath string) {
runErr = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--yes", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
runErr = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--yes", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
},
// Assert
func(t *testing.T) {
Expand Down Expand Up @@ -154,7 +148,7 @@ func TestInstall_ValidArgumentNotRun(t *testing.T) {
},
// Act
func(t *testing.T, egnPath string) {
runErr = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
runErr = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
},
// Assert
func(t *testing.T) {
Expand All @@ -180,11 +174,11 @@ func TestInstall_DuplicatedID(t *testing.T) {
if err := buildMockAvsImages(t); err != nil {
return err
}
return runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--tag", "integration", "--yes", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
return runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--tag", "integration", "--yes", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
},
// Act
func(t *testing.T, egnPath string) {
runErr = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--tag", "integration", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
runErr = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--tag", "integration", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
},
// Assert
func(t *testing.T) {
Expand Down Expand Up @@ -217,13 +211,13 @@ func TestInstall_DuplicatedContainerNameWithMonitoring(t *testing.T) {
if err != nil {
return err
}
return runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--yes", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
return runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--yes", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
},
// Act
func(t *testing.T, egnPath string) {
// Uses different tag, but docker compose create will fail because of duplicated container name
// The install should fail but the monitoring stack should be running and the instance should be cleaned up
runErr = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--tag", "integration", "--yes", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
runErr = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--tag", "integration", "--yes", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
},
// Assert
func(t *testing.T) {
Expand Down Expand Up @@ -261,9 +255,9 @@ func TestInstall_MultipleAVS(t *testing.T) {
},
// Act
func(t *testing.T, egnPath string) {
runErr[0] = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--yes", "--tag", "option-returner-1", "--option.main-container-name", "main-service-1", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
runErr[1] = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--yes", "--tag", "option-returner-2", "--option.main-container-name", "main-service-2", "--option.main-port", "8081", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
runErr[2] = runCommand(t, egnPath, "install", "--profile", "health-checker", "--no-prompt", "--tag", "health-checker", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
runErr[0] = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--yes", "--tag", "option-returner-1", "--option.main-container-name", "main-service-1", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
runErr[1] = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--yes", "--tag", "option-returner-2", "--option.main-container-name", "main-service-2", "--option.main-port", "8081", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
runErr[2] = runCommand(t, egnPath, "install", "--profile", "health-checker", "--no-prompt", "--tag", "health-checker", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
},
// Assert
func(t *testing.T) {
Expand Down Expand Up @@ -309,11 +303,11 @@ func TestInstall_MultipleAVSWithMonitoring(t *testing.T) {
},
// Act
func(t *testing.T, egnPath string) {
runErr[0] = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--yes", "--tag", "option-returner-1", "--option.main-container-name", "main-service-1", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
runErr[0] = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--yes", "--tag", "option-returner-1", "--option.main-container-name", "main-service-1", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
time.Sleep(5 * time.Second)
runErr[1] = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--yes", "--tag", "option-returner-2", "--option.main-container-name", "main-service-2", "--option.main-port", "8081", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
runErr[1] = runCommand(t, egnPath, "install", "--profile", "option-returner", "--no-prompt", "--yes", "--tag", "option-returner-2", "--option.main-container-name", "main-service-2", "--option.main-port", "8081", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
time.Sleep(5 * time.Second)
runErr[2] = runCommand(t, egnPath, "install", "--profile", "health-checker", "--no-prompt", "--yes", "--tag", "health-checker", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
runErr[2] = runCommand(t, egnPath, "install", "--profile", "health-checker", "--no-prompt", "--yes", "--tag", "health-checker", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
},
// Assert
func(t *testing.T) {
Expand Down Expand Up @@ -358,7 +352,7 @@ func TestInstall_HighRequirements(t *testing.T) {
},
// Act
func(t *testing.T, egnPath string) {
runErr = runCommand(t, egnPath, "install", "--profile", "high-requirements", "--no-prompt", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
runErr = runCommand(t, egnPath, "install", "--profile", "high-requirements", "--no-prompt", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
},
// Assert
func(t *testing.T) {
Expand Down
16 changes: 8 additions & 8 deletions e2e/local_install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestLocalInstall(t *testing.T) {
if err != nil {
return err
}
err = runCommand(t, "git", "clone", "--single-branch", "-b", latestMockAVSVersion, mockAVSRepo, pkgDir)
err = runCommand(t, "git", "clone", "--single-branch", "-b", latestMockAVSPkgVersion, mockAVSPkgRepo, pkgDir)
if err != nil {
return err
}
Expand Down Expand Up @@ -72,7 +72,7 @@ func TestLocalInstallNotRunning(t *testing.T) {
if err != nil {
return err
}
err = runCommand(t, "git", "clone", "--single-branch", "-b", latestMockAVSVersion, mockAVSRepo, pkgDir)
err = runCommand(t, "git", "clone", "--single-branch", "-b", latestMockAVSPkgVersion, mockAVSPkgRepo, pkgDir)
if err != nil {
return err
}
Expand Down Expand Up @@ -117,7 +117,7 @@ func TestLocalInstallWithMonitoring(t *testing.T) {
if err != nil {
return err
}
err = runCommand(t, "git", "clone", "--single-branch", "-b", latestMockAVSVersion, mockAVSRepo, pkgDir)
err = runCommand(t, "git", "clone", "--single-branch", "-b", latestMockAVSPkgVersion, mockAVSPkgRepo, pkgDir)
if err != nil {
return err
}
Expand Down Expand Up @@ -166,7 +166,7 @@ func TestLocalInstallInvalidManifest(t *testing.T) {
if err != nil {
return err
}
err = runCommand(t, "git", "clone", "--single-branch", "-b", latestMockAVSVersion, mockAVSRepo, pkgDir)
err = runCommand(t, "git", "clone", "--single-branch", "-b", latestMockAVSPkgVersion, mockAVSPkgRepo, pkgDir)
if err != nil {
return err
}
Expand Down Expand Up @@ -213,7 +213,7 @@ func TestLocalInstallInvalidManifestCleanup(t *testing.T) {
if err != nil {
return err
}
err = runCommand(t, "git", "clone", "--single-branch", "-b", latestMockAVSVersion, mockAVSRepo, pkgDir)
err = runCommand(t, "git", "clone", "--single-branch", "-b", latestMockAVSPkgVersion, mockAVSPkgRepo, pkgDir)
if err != nil {
return err
}
Expand Down Expand Up @@ -265,7 +265,7 @@ func TestLocalInstallInvalidManifestCleanupWithMonitoring(t *testing.T) {
if err != nil {
return err
}
err = runCommand(t, "git", "clone", "--single-branch", "-b", latestMockAVSVersion, mockAVSRepo, pkgDir)
err = runCommand(t, "git", "clone", "--single-branch", "-b", latestMockAVSPkgVersion, mockAVSPkgRepo, pkgDir)
if err != nil {
return err
}
Expand Down Expand Up @@ -315,7 +315,7 @@ func TestLocalInstallInvalidComposeCleanup(t *testing.T) {
if err != nil {
return err
}
err = runCommand(t, "git", "clone", "--single-branch", "-b", latestMockAVSVersion, mockAVSRepo, pkgDir)
err = runCommand(t, "git", "clone", "--single-branch", "-b", latestMockAVSPkgVersion, mockAVSPkgRepo, pkgDir)
if err != nil {
return err
}
Expand Down Expand Up @@ -366,7 +366,7 @@ func TestLocalInstall_DuplicatedContainerNameWithMonitoring(t *testing.T) {
if err != nil {
return err
}
err = runCommand(t, "git", "clone", "--single-branch", "-b", latestMockAVSVersion, mockAVSRepo, pkgDir)
err = runCommand(t, "git", "clone", "--single-branch", "-b", latestMockAVSPkgVersion, mockAVSPkgRepo, pkgDir)
if err != nil {
return err
}
Expand Down
20 changes: 10 additions & 10 deletions e2e/ls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestLs_NotRunning(t *testing.T) {
if err != nil {
return err
}
return runCommand(t, eigenlayerPath, "install", "--profile", "option-returner", "--no-prompt", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
return runCommand(t, eigenlayerPath, "install", "--profile", "option-returner", "--no-prompt", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
},
func(t *testing.T, eigenlayerPath string) {
out, lsErr = runCommandOutput(t, eigenlayerPath, "ls")
Expand All @@ -53,7 +53,7 @@ func TestLs_NotRunning(t *testing.T) {
assert.NoError(t, lsErr, "ls command should not return an error")
assert.Equal(t, out, []byte(
"AVS Instance ID RUNNING HEALTH VERSION COMMIT COMMENT \n"+
"mock-avs-default false unknown "+latestMockAVSVersion+" a7ca2dca2cc9 \n",
"mock-avs-default false unknown "+latestMockAVSPkgVersion+" "+latestMockAVSCommitHash[:12]+" \n",
))
})
e2eTest.run()
Expand All @@ -71,7 +71,7 @@ func TestLs_RunningHealthy(t *testing.T) {
if err != nil {
return err
}
err = runCommand(t, eigenlayerPath, "install", "--profile", "option-returner", "--yes", "--no-prompt", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
err = runCommand(t, eigenlayerPath, "install", "--profile", "option-returner", "--yes", "--no-prompt", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
if err != nil {
return err
}
Expand All @@ -84,7 +84,7 @@ func TestLs_RunningHealthy(t *testing.T) {
assert.NoError(t, lsErr, "ls command should not return an error")
assert.Equal(t, out, []byte(
"AVS Instance ID RUNNING HEALTH VERSION COMMIT COMMENT \n"+
"mock-avs-default true healthy "+latestMockAVSVersion+" a7ca2dca2cc9 \n",
"mock-avs-default true healthy "+latestMockAVSPkgVersion+" "+latestMockAVSCommitHash[:12]+" \n",
))
})
e2eTest.run()
Expand All @@ -102,7 +102,7 @@ func TestLs_RunningPartiallyHealthy(t *testing.T) {
if err != nil {
return err
}
err = runCommand(t, eigenlayerPath, "install", "--profile", "option-returner", "--yes", "--no-prompt", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
err = runCommand(t, eigenlayerPath, "install", "--profile", "option-returner", "--yes", "--no-prompt", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
if err != nil {
return err
}
Expand All @@ -119,7 +119,7 @@ func TestLs_RunningPartiallyHealthy(t *testing.T) {
assert.NoError(t, lsErr, "ls command should not return an error")
assert.Equal(t, out, []byte(
"AVS Instance ID RUNNING HEALTH VERSION COMMIT COMMENT \n"+
"mock-avs-default true partially healthy "+latestMockAVSVersion+" a7ca2dca2cc9 \n",
"mock-avs-default true partially healthy "+latestMockAVSPkgVersion+" "+latestMockAVSCommitHash[:12]+" \n",
))
})
e2eTest.run()
Expand All @@ -137,7 +137,7 @@ func TestLs_RunningUnhealthy(t *testing.T) {
if err != nil {
return err
}
err = runCommand(t, eigenlayerPath, "install", "--profile", "option-returner", "--yes", "--no-prompt", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
err = runCommand(t, eigenlayerPath, "install", "--profile", "option-returner", "--yes", "--no-prompt", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
if err != nil {
return err
}
Expand All @@ -154,7 +154,7 @@ func TestLs_RunningUnhealthy(t *testing.T) {
assert.NoError(t, lsErr, "ls command should not return an error")
assert.Equal(t, out, []byte(
"AVS Instance ID RUNNING HEALTH VERSION COMMIT COMMENT \n"+
"mock-avs-default true unhealthy "+latestMockAVSVersion+" a7ca2dca2cc9 \n",
"mock-avs-default true unhealthy "+latestMockAVSPkgVersion+" "+latestMockAVSCommitHash[:12]+" \n",
))
})
e2eTest.run()
Expand All @@ -173,7 +173,7 @@ func TestLs_Comment(t *testing.T) {
if err != nil {
return err
}
err = runCommand(t, eigenlayerPath, "install", "--profile", "option-returner", "--yes", "--no-prompt", "--version", latestMockAVSVersion, "https://github.com/NethermindEth/mock-avs-pkg")
err = runCommand(t, eigenlayerPath, "install", "--profile", "option-returner", "--yes", "--no-prompt", "--version", latestMockAVSPkgVersion, mockAVSPkgRepo)
if err != nil {
return err
}
Expand Down Expand Up @@ -202,7 +202,7 @@ func TestLs_Comment(t *testing.T) {
}
assert.Equal(t, []byte(
"AVS Instance ID RUNNING HEALTH VERSION COMMIT COMMENT"+ds+" \n"+
"mock-avs-default true unknown "+latestMockAVSVersion+" a7ca2dca2cc9 API container is running but health check failed: Get \"http://"+containerIP+":8081/eigen/node/health\": dial tcp "+containerIP+":8081: connect: connection refused \n",
"mock-avs-default true unknown "+latestMockAVSPkgVersion+" "+latestMockAVSCommitHash[:12]+" API container is running but health check failed: Get \"http://"+containerIP+":8081/eigen/node/health\": dial tcp "+containerIP+":8081: connect: connection refused \n",
), out)
})
e2eTest.run()
Expand Down
4 changes: 2 additions & 2 deletions e2e/monitoring_stack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func TestMonitoring_Restart(t *testing.T) {
if err != nil {
return err
}
err = runCommand(t, egnPath, "install", "--profile", "option-returner", "--yes", "--no-prompt", "--tag", "tag-1", "--option.main-container-name", "main-service-1", "https://github.com/NethermindEth/mock-avs-pkg")
err = runCommand(t, egnPath, "install", "--profile", "option-returner", "--yes", "--no-prompt", "--tag", "tag-1", "--option.main-container-name", "main-service-1", mockAVSPkgRepo)
if err != nil {
return err
}
Expand All @@ -147,7 +147,7 @@ func TestMonitoring_Restart(t *testing.T) {
},
// Act
func(t *testing.T, egnPath string) {
runErr = runCommand(t, egnPath, "install", "--profile", "option-returner", "--yes", "--no-prompt", "--tag", "tag-2", "--option.main-container-name", "main-service-2", "--option.network-name", "eigenlayer-2", "--option.main-port", "8081", "https://github.com/NethermindEth/mock-avs-pkg")
runErr = runCommand(t, egnPath, "install", "--profile", "option-returner", "--yes", "--no-prompt", "--tag", "tag-2", "--option.main-container-name", "main-service-2", "--option.network-name", "eigenlayer-2", "--option.main-port", "8081", mockAVSPkgRepo)
},
// Assert
func(t *testing.T) {
Expand Down
Loading

0 comments on commit 1073ef9

Please sign in to comment.