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

ci: use certificate auth on native #1909

Merged
merged 8 commits into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion integration/test/installer/harvest.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ func (h *Harvest) Start() {
fmt.Println(status)
time.Sleep(30 * time.Second)
h.AllRunning()

}

func (h *Harvest) StartByHarvestUser() {
Expand Down
10 changes: 1 addition & 9 deletions integration/test/installer/native.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,7 @@ func (n *Native) Install() bool {
unTarOutput := utils.Run("tar", "-xf", tarFileName, "--one-top-level=harvest", "--strip-components", "1", "-C", "/opt")
log.Println(unTarOutput)
utils.RemoveSafely(HarvestHome + "/" + harvestFile)
log.Println("Copy certificates files into harvest directory")
path := HarvestHome + "/certificates"
if utils.FileExists(path) {
err = utils.RemoveDir(path)
utils.PanicIfNotNil(err)
}

utils.Run("mkdir", "-p", path)
utils.Run("cp", "-R", utils.GetConfigDir()+"/certificates", HarvestHome)
utils.UseCertFile(HarvestHome)
utils.Run("cp", setup.GetPerfFileWithQosCounters(setup.ZapiPerfDefaultFile, "defaultZapi.yaml"), HarvestHome+"/"+setup.ZapiPerfDefaultFile)
utils.Run("cp", setup.GetPerfFileWithQosCounters(setup.RestPerfDefaultFile, "defaultRest.yaml"), HarvestHome+"/"+setup.RestPerfDefaultFile)
err = utils.CopyFile(harvestFile, HarvestHome+"/"+harvestFile)
Expand Down
9 changes: 1 addition & 8 deletions integration/test/installer/rpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,8 @@ func (r *RPM) Install() bool {
log.Println("Installing " + rpmFileName)
installOutput := utils.Run("yum", "install", "-y", rpmFileName)
log.Println(installOutput)
log.Println("Stopping harvest before copying ONTAP certificates")
log.Println("Stopping harvest")
harvestObj.Stop()
log.Println("Copy certificates files into harvest directory")
path := HarvestHome + "/certificates"
if utils.FileExists(path) {
err = utils.RemoveDir(path)
utils.PanicIfNotNil(err)
}
utils.Run("mkdir", "-p", path)
utils.Run("cp", "-R", utils.GetConfigDir()+"/certificates", HarvestHome)
copyErr := utils.CopyFile(harvestFile, HarvestHome+"/harvest.yml")
if copyErr != nil {
Expand Down
8 changes: 3 additions & 5 deletions integration/test/native_installer_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build install_native
// +build install_native

package main

Expand All @@ -17,7 +16,6 @@ func TestNativeInstall(t *testing.T) {
if len(path) == 0 {
panic("BUILD_PATH variable is not set.")
}
utils.UseCertFile()
installObject, err := installer.GetInstaller(installer.GRAFANA, "grafana/grafana")
if err != nil {
log.Println("Unable to initialize installer object for " + installer.GRAFANA)
Expand All @@ -29,10 +27,10 @@ func TestNativeInstall(t *testing.T) {
token := utils.CreateGrafanaToken()
utils.WriteToken(token)

installObject, error := installer.GetInstaller(installer.NATIVE, path)
if error != nil {
installObject, err2 := installer.GetInstaller(installer.NATIVE, path)
if err2 != nil {
log.Println("Unable to initialize installer object")
panic(error)
panic(err2)
}
if installObject.Install() {
log.Println("Installation is successful..")
Expand Down
7 changes: 3 additions & 4 deletions integration/test/rpm_installer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ func TestRHELInstall(t *testing.T) {
if len(path) == 0 {
panic("BUILD_PATH variable is not set.")
}
utils.UseCertFile()
installObject, err := installer.GetInstaller(installer.GRAFANA, "grafana/grafana")
if err != nil {
log.Println("Unable to initialize installer object for " + installer.GRAFANA)
Expand All @@ -28,10 +27,10 @@ func TestRHELInstall(t *testing.T) {
token := utils.CreateGrafanaToken()
utils.WriteToken(token)

installObject, error := installer.GetInstaller(installer.RHEL, path)
if error != nil {
installObject, err2 := installer.GetInstaller(installer.RHEL, path)
if err2 != nil {
log.Println("Unable to initialize installer object")
panic(error)
panic(err2)
}
if installObject.Install() {
log.Println("Installation is successful..")
Expand Down
17 changes: 12 additions & 5 deletions integration/test/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,21 @@ func RemoveDir(dir string) error {
return nil
}

func UseCertFile() {
func UseCertFile(harvestHome string) {
// Copy harvest_cert_2023.yml from /u/ to local
harvestCertFile := "harvest_cert_2023.yml"
harvestFile := "harvest.yml"
harvestCertFile := "harvest_cert.yml"
RemoveSafely(harvestFile)
err := CopyFile(harvestCertFile, harvestFile)
if err != nil {
Run("cp", "-p", GetConfigDir()+"/"+harvestCertFile, harvestHome+"/"+harvestFile)
Run("certer", "-ip", "10.193.48.11")

path := harvestHome + "/cert"
log.Info().Str("path", path).Msg("Copy certificate files")
if FileExists(path) {
err := RemoveDir(path)
PanicIfNotNil(err)
}
Run("mkdir", "-p", path)
Run("cp", "-R", GetConfigDir()+"/cert", harvestHome)
}

func RemoveSafely(filename string) bool {
Expand Down