Skip to content

Commit

Permalink
Merge pull request #8790 from travisn/test-local-build
Browse files Browse the repository at this point in the history
test: Run all integration tests against the local build
  • Loading branch information
travisn committed Sep 22, 2021
2 parents 9fa8c5d + 9ff0753 commit 4583a80
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 22 deletions.
2 changes: 1 addition & 1 deletion tests/framework/installer/ceph_helm_installer.go
Expand Up @@ -77,7 +77,7 @@ func (h *CephInstaller) CreateRookCephClusterViaHelm(values map[string]interface
values["configOverride"] = clusterCustomSettings
values["toolbox"] = map[string]interface{}{
"enabled": true,
"image": "rook/ceph:master",
"image": "rook/ceph:" + LocalBuildTag,
}
values["cephClusterSpec"] = clusterCRD["spec"]

Expand Down
10 changes: 5 additions & 5 deletions tests/framework/installer/ceph_installer.go
Expand Up @@ -448,7 +448,7 @@ func (h *CephInstaller) installRookOperator() (bool, error) {
startDiscovery = true
err := h.CreateRookOperatorViaHelm(map[string]interface{}{
"enableDiscoveryDaemon": true,
"image": map[string]interface{}{"tag": "master"},
"image": map[string]interface{}{"tag": LocalBuildTag},
})
if err != nil {
return false, errors.Wrap(err, "failed to configure helm")
Expand Down Expand Up @@ -479,7 +479,7 @@ func (h *CephInstaller) installRookOperator() (bool, error) {
}

func (h *CephInstaller) InstallRook() (bool, error) {
if h.settings.RookVersion != VersionMaster {
if h.settings.RookVersion != LocalBuildTag {
// make sure we have the images from a previous release locally so the test doesn't hit a timeout
assert.NoError(h.T(), h.k8shelper.GetDockerImage("rook/ceph:"+h.settings.RookVersion))
}
Expand All @@ -499,7 +499,7 @@ func (h *CephInstaller) InstallRook() (bool, error) {

if h.settings.UseHelm {
err = h.CreateRookCephClusterViaHelm(map[string]interface{}{
"image": "rook/ceph:master",
"image": "rook/ceph:" + LocalBuildTag,
})
if err != nil {
return false, errors.Wrap(err, "failed to install ceph cluster using Helm")
Expand Down Expand Up @@ -901,7 +901,7 @@ spec:
restartPolicy: Never
containers:
- name: rook-cleaner
image: rook/ceph:` + VersionMaster + `
image: rook/ceph:` + LocalBuildTag + `
securityContext:
privileged: true
volumeMounts:
Expand Down Expand Up @@ -931,7 +931,7 @@ spec:
restartPolicy: Never
containers:
- name: rook-cleaner
image: rook/ceph:` + VersionMaster + `
image: rook/ceph:` + LocalBuildTag + `
securityContext:
privileged: true
volumeMounts:
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/installer/ceph_manifests.go
Expand Up @@ -56,7 +56,7 @@ type CephManifestsMaster struct {
// NewCephManifests gets the manifest type depending on the Rook version desired
func NewCephManifests(settings *TestCephSettings) CephManifests {
switch settings.RookVersion {
case VersionMaster:
case LocalBuildTag:
return &CephManifestsMaster{settings}
case Version1_6:
return &CephManifestsV1_6{settings}
Expand Down
4 changes: 2 additions & 2 deletions tests/framework/installer/installer.go
Expand Up @@ -28,8 +28,8 @@ import (
)

const (
// VersionMaster tag for the latest manifests
VersionMaster = "master"
// LocalBuildTag tag for the latest manifests
LocalBuildTag = "local-build"

// test suite names
CassandraTestSuite = "cassandra"
Expand Down
5 changes: 4 additions & 1 deletion tests/framework/installer/settings.go
Expand Up @@ -21,12 +21,15 @@ import (
"io/ioutil"
"net/http"
"path"
"regexp"
"time"

"github.com/pkg/errors"
"github.com/rook/rook/tests/framework/utils"
)

var imageMatch = regexp.MustCompile(`image: rook\/ceph:[a-z0-9.-]+`)

func readManifest(provider, filename string) string {
rootDir, err := utils.FindRookRoot()
if err != nil {
Expand All @@ -38,7 +41,7 @@ func readManifest(provider, filename string) string {
if err != nil {
panic(errors.Wrapf(err, "failed to read manifest at %s", manifest))
}
return string(contents)
return imageMatch.ReplaceAllString(string(contents), "image: rook/ceph:"+LocalBuildTag)
}

func readManifestFromGithub(rookVersion, provider, filename string) string {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/ceph_flex_test.go
Expand Up @@ -94,7 +94,7 @@ func (s *CephFlexDriverSuite) SetupSuite() {
SkipOSDCreation: false,
UseCSI: false,
DirectMountToolbox: true,
RookVersion: installer.VersionMaster,
RookVersion: installer.LocalBuildTag,
CephVersion: installer.OctopusVersion,
}
s.settings.ApplyEnvVars()
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/ceph_helm_test.go
Expand Up @@ -73,7 +73,7 @@ func (h *HelmSuite) SetupSuite() {
SkipOSDCreation: false,
EnableAdmissionController: false,
EnableDiscovery: true,
RookVersion: installer.VersionMaster,
RookVersion: installer.LocalBuildTag,
CephVersion: installer.OctopusVersion,
}
h.settings.ApplyEnvVars()
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/ceph_mgr_test.go
Expand Up @@ -95,7 +95,7 @@ func (s *CephMgrSuite) SetupSuite() {
UseCSI: true,
SkipOSDCreation: true,
EnableDiscovery: true,
RookVersion: installer.VersionMaster,
RookVersion: installer.LocalBuildTag,
CephVersion: installer.MasterVersion,
}
s.settings.ApplyEnvVars()
Expand Down Expand Up @@ -224,7 +224,7 @@ func (s *CephMgrSuite) TestStatus() {
assert.Equal(s.T(), status, "Backend: rook\nAvailable: Yes")
}

func logBytesInfo(bytesSlice []byte){
func logBytesInfo(bytesSlice []byte) {
logger.Infof("---- bytes slice info ---")
logger.Infof("bytes: %v\n", bytesSlice)
logger.Infof("length: %d\n", len(bytesSlice))
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/ceph_multi_cluster_test.go
Expand Up @@ -87,7 +87,7 @@ func (s *MultiClusterDeploySuite) SetupSuite() {
UseCSI: true,
MultipleMgrs: true,
EnableAdmissionController: true,
RookVersion: installer.VersionMaster,
RookVersion: installer.LocalBuildTag,
CephVersion: installer.NautilusVersion,
}
s.settings.ApplyEnvVars()
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/ceph_object_test.go
Expand Up @@ -75,7 +75,7 @@ func (s *ObjectSuite) SetupSuite() {
UseCSI: true,
EnableAdmissionController: true,
UseCrashPruner: true,
RookVersion: installer.VersionMaster,
RookVersion: installer.LocalBuildTag,
CephVersion: installer.PacificVersion,
}
s.settings.ApplyEnvVars()
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/ceph_smoke_test.go
Expand Up @@ -99,7 +99,7 @@ func (s *SmokeSuite) SetupSuite() {
UseCSI: true,
EnableAdmissionController: true,
UseCrashPruner: true,
RookVersion: installer.VersionMaster,
RookVersion: installer.LocalBuildTag,
CephVersion: installer.PacificVersion,
}
s.settings.ApplyEnvVars()
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/ceph_upgrade_test.go
Expand Up @@ -183,7 +183,7 @@ func (s *UpgradeSuite) TestUpgradeToMaster() {
s.gatherLogs(s.settings.OperatorNamespace, "_before_master_upgrade")
s.upgradeToMaster()

s.verifyOperatorImage(installer.VersionMaster)
s.verifyOperatorImage(installer.LocalBuildTag)
s.verifyRookUpgrade(numOSDs)
err = s.installer.WaitForToolbox(s.namespace)
assert.NoError(s.T(), err)
Expand Down Expand Up @@ -359,15 +359,15 @@ func (s *UpgradeSuite) verifyFilesAfterUpgrade(fsName, newFileToWrite, messageFo
// verify the upgrade but merely starts the upgrade process.
func (s *UpgradeSuite) upgradeToMaster() {
// Apply the CRDs for the latest master
s.settings.RookVersion = installer.VersionMaster
s.settings.RookVersion = installer.LocalBuildTag
m := installer.NewCephManifests(s.settings)
require.NoError(s.T(), s.k8sh.ResourceOperation("apply", m.GetCRDs(s.k8sh)))

require.NoError(s.T(), s.k8sh.ResourceOperation("apply", m.GetCommon()))

require.NoError(s.T(),
s.k8sh.SetDeploymentVersion(s.settings.OperatorNamespace, operatorContainer, operatorContainer, installer.VersionMaster))
s.k8sh.SetDeploymentVersion(s.settings.OperatorNamespace, operatorContainer, operatorContainer, installer.LocalBuildTag))

require.NoError(s.T(),
s.k8sh.SetDeploymentVersion(s.settings.Namespace, "rook-ceph-tools", "rook-ceph-tools", installer.VersionMaster))
s.k8sh.SetDeploymentVersion(s.settings.Namespace, "rook-ceph-tools", "rook-ceph-tools", installer.LocalBuildTag))
}
2 changes: 1 addition & 1 deletion tests/scripts/github-action-helper.sh
Expand Up @@ -121,7 +121,7 @@ function build_rook() {
tests/scripts/validate_modified_files.sh build
docker images
if [[ "$build_type" == "build" ]]; then
docker tag "$(docker images | awk '/build-/ {print $1}')" rook/ceph:master
docker tag "$(docker images | awk '/build-/ {print $1}')" rook/ceph:local-build
fi
}

Expand Down

0 comments on commit 4583a80

Please sign in to comment.