Skip to content

Commit

Permalink
modification to support gcp in test
Browse files Browse the repository at this point in the history
Signed-off-by: Vivek Reddy <vivekrsplunk@github.com>
  • Loading branch information
Vivek Reddy committed Oct 11, 2024
1 parent d2f01bd commit a8f8741
Show file tree
Hide file tree
Showing 10 changed files with 3,805 additions and 3,038 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package azurem4appfw
package gcpc3appfw

import (
"context"
"os"
"path/filepath"
"testing"
Expand All @@ -36,19 +35,19 @@ const (
)

var (
testenvInstance *testenv.TestEnv
testSuiteName = "m4appfw-" + testenv.RandomDNSName(3)
appListV1 []string
appListV2 []string
AzureDataContainer = os.Getenv("TEST_CONTAINER")
AzureContainer = os.Getenv("INDEXES_CONTAINER")
AzureStorageAccount = os.Getenv("AZURE_STORAGE_ACCOUNT")
AzureAppDirV1 = testenv.AppLocationV1
AzureAppDirV2 = testenv.AppLocationV2
AzureAppDirDisabled = testenv.AppLocationDisabledApps
currDir, _ = os.Getwd()
downloadDirV1 = filepath.Join(currDir, "m4appfwV1-"+testenv.RandomDNSName(4))
downloadDirV2 = filepath.Join(currDir, "m4appfwV2-"+testenv.RandomDNSName(4))
testenvInstance *testenv.TestEnv
testSuiteName = "c3appfw-" + testenv.RandomDNSName(3)
appListV1 []string
appListV2 []string
testDataS3Bucket = os.Getenv("TEST_BUCKET")
testS3Bucket = os.Getenv("TEST_INDEXES_S3_BUCKET")
s3AppDirV1 = testenv.AppLocationV1
s3AppDirV2 = testenv.AppLocationV2
s3PVTestApps = testenv.PVTestAppsLocation
currDir, _ = os.Getwd()
downloadDirV1 = filepath.Join(currDir, "c3appfwV1-"+testenv.RandomDNSName(4))
downloadDirV2 = filepath.Join(currDir, "c3appfwV2-"+testenv.RandomDNSName(4))
downloadDirPVTestApps = filepath.Join(currDir, "c3appfwPVTestApps-"+testenv.RandomDNSName(4))
)

// TestBasic is the main entry point
Expand All @@ -60,32 +59,30 @@ func TestBasic(t *testing.T) {
}

var _ = BeforeSuite(func() {
ctx := context.TODO()
var err error
testenvInstance, err = testenv.NewDefaultTestEnv(testSuiteName)
Expect(err).ToNot(HaveOccurred())

if testenv.ClusterProvider == "gcp" {
// Create a list of apps to upload to Azure
// Create a list of apps to upload to S3
appListV1 = testenv.BasicApps
appFileList := testenv.GetAppFileList(appListV1)

// Download V1 Apps from Azure
containerName := "/test-data/appframework/v1apps/"
err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList)
// Download V1 Apps from S3
err = testenv.DownloadFilesFromGCP(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList)
Expect(err).To(Succeed(), "Unable to download V1 app files")

// Create a list of apps to upload to Azure after poll period
// Create a list of apps to upload to S3 after poll period
appListV2 = append(appListV1, testenv.NewAppsAddedBetweenPolls...)
appFileList = testenv.GetAppFileList(appListV2)

// Download V2 Apps from Azure
containerName = "/test-data/appframework/v2apps/"
err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV2, containerName, appFileList)
// Download V2 Apps from S3
err = testenv.DownloadFilesFromGCP(testDataS3Bucket, s3AppDirV2, downloadDirV2, appFileList)
Expect(err).To(Succeed(), "Unable to download V2 app files")
} else {
testenvInstance.Log.Info("Skipping Before Suite Setup", "Cluster Provider", testenv.ClusterProvider)
}

})

var _ = AfterSuite(func() {
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package azurec3appfw
package gcpm4appfw

import (
"context"
"os"
"path/filepath"
"testing"
Expand All @@ -36,19 +35,19 @@ const (
)

var (
testenvInstance *testenv.TestEnv
testSuiteName = "c3appfw-" + testenv.RandomDNSName(3)
appListV1 []string
appListV2 []string
AzureDataContainer = os.Getenv("TEST_CONTAINER")
AzureContainer = os.Getenv("INDEXES_CONTAINER")
AzureStorageAccount = os.Getenv("AZURE_STORAGE_ACCOUNT")
AzureAppDirV1 = testenv.AppLocationV1
AzureAppDirV2 = testenv.AppLocationV2
AzureAppDirDisabled = testenv.AppLocationDisabledApps
currDir, _ = os.Getwd()
downloadDirV1 = filepath.Join(currDir, "c3appfwV1-"+testenv.RandomDNSName(4))
downloadDirV2 = filepath.Join(currDir, "c3appfwV2-"+testenv.RandomDNSName(4))
testenvInstance *testenv.TestEnv
testSuiteName = "m4appfw-" + testenv.RandomDNSName(3)
appListV1 []string
appListV2 []string
testDataS3Bucket = os.Getenv("TEST_BUCKET")
testS3Bucket = os.Getenv("TEST_INDEXES_S3_BUCKET")
s3AppDirV1 = testenv.AppLocationV1
s3AppDirV2 = testenv.AppLocationV2
s3PVTestApps = testenv.PVTestAppsLocation
currDir, _ = os.Getwd()
downloadDirV1 = filepath.Join(currDir, "m4appfwV1-"+testenv.RandomDNSName(4))
downloadDirV2 = filepath.Join(currDir, "m4appfwV2-"+testenv.RandomDNSName(4))
downloadDirPVTestApps = filepath.Join(currDir, "m4appfwPVTestApps-"+testenv.RandomDNSName(4))
)

// TestBasic is the main entry point
Expand All @@ -60,39 +59,41 @@ func TestBasic(t *testing.T) {
}

var _ = BeforeSuite(func() {
ctx := context.TODO()
var err error
testenvInstance, err = testenv.NewDefaultTestEnv(testSuiteName)
Expect(err).ToNot(HaveOccurred())

if testenv.ClusterProvider == "gcp" {
// Create a list of apps to upload to Azure
// Create a list of apps to upload to S3
appListV1 = testenv.BasicApps
appFileList := testenv.GetAppFileList(appListV1)

// Download V1 Apps from Azure
containerName := "/test-data/appframework/v1apps/"
err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList)
// Download V1 Apps from S3
err = testenv.DownloadFilesFromGCP(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList)
Expect(err).To(Succeed(), "Unable to download V1 app files")

// Create a list of apps to upload to Azure after poll period
// Create a list of apps to upload to S3 after poll period
appListV2 = append(appListV1, testenv.NewAppsAddedBetweenPolls...)
appFileList = testenv.GetAppFileList(appListV2)

// Download V2 Apps from Azure
containerName = "/test-data/appframework/v2apps/"
err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV2, containerName, appFileList)
// Download V2 Apps from S3
err = testenv.DownloadFilesFromGCP(testDataS3Bucket, s3AppDirV2, downloadDirV2, appFileList)
Expect(err).To(Succeed(), "Unable to download V2 app files")
} else {
testenvInstance.Log.Info("Skipping Before Suite Setup", "Cluster Provider", testenv.ClusterProvider)
}

})

var _ = AfterSuite(func() {
if testenvInstance != nil {
Expect(testenvInstance.Teardown()).ToNot(HaveOccurred())
}

if testenvInstance != nil {
Expect(testenvInstance.Teardown()).ToNot(HaveOccurred())
}

// Delete locally downloaded app files
err := os.RemoveAll(downloadDirV1)
Expect(err).To(Succeed(), "Unable to delete locally downloaded V1 app files")
Expand Down
Loading

0 comments on commit a8f8741

Please sign in to comment.