-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alex Castilio dos Santos <[email protected]>
- Loading branch information
1 parent
6d9050c
commit a853797
Showing
6 changed files
with
126 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package retina | ||
|
||
import ( | ||
"context" | ||
"crypto/rand" | ||
"math/big" | ||
"os" | ||
"os/user" | ||
"path/filepath" | ||
"strconv" | ||
"testing" | ||
"time" | ||
|
||
"github.com/microsoft/retina/test/e2e/common" | ||
"github.com/microsoft/retina/test/e2e/framework/types" | ||
jobs "github.com/microsoft/retina/test/e2e/jobs" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestE2ERetina_Scale(t *testing.T) { | ||
deadline, _ := t.Deadline() | ||
ctx, cancel := context.WithDeadline(context.Background(), deadline) | ||
defer cancel() | ||
|
||
curuser, err := user.Current() | ||
require.NoError(t, err) | ||
|
||
clusterName := curuser.Username + common.NetObsRGtag + strconv.FormatInt(time.Now().Unix(), 10) | ||
|
||
subID := os.Getenv("AZURE_SUBSCRIPTION_ID") | ||
require.NotEmpty(t, subID) | ||
|
||
location := os.Getenv("AZURE_LOCATION") | ||
if location == "" { | ||
var nBig *big.Int | ||
nBig, err = rand.Int(rand.Reader, big.NewInt(int64(len(locations)))) | ||
if err != nil { | ||
t.Fatalf("Failed to generate a secure random index: %v", err) | ||
} | ||
location = locations[nBig.Int64()] | ||
} | ||
cwd, err := os.Getwd() | ||
require.NoError(t, err) | ||
|
||
// Get to root of the repo by going up two directories | ||
rootDir := filepath.Dir(filepath.Dir(cwd)) | ||
|
||
chartPath := filepath.Join(rootDir, "deploy", "legacy", "manifests", "controller", "helm", "retina") | ||
kubeConfigFilePath := filepath.Join(rootDir, "test", "e2e", "test.pem") | ||
|
||
// CreateTestInfra | ||
createTestInfra := types.NewRunner(t, jobs.CreateTestInfra(subID, clusterName, location, kubeConfigFilePath)) | ||
createTestInfra.Run(ctx) | ||
|
||
t.Cleanup(func() { | ||
_ = jobs.DeleteTestInfra(subID, clusterName, location).Run() | ||
}) | ||
|
||
// Install Retina | ||
installRetina := types.NewRunner(t, jobs.InstallRetina(kubeConfigFilePath, chartPath)) | ||
installRetina.Run(ctx) | ||
|
||
// TODO: Scale Cluster | ||
|
||
// TODO: equivalent of github.com/Azure/azure-container-networking/test/scale/test-scale.sh | ||
} |