Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
rollback persistent volume to three

Signed-off-by: qiaozp <[email protected]>
  • Loading branch information
chivalryq committed Sep 21, 2023
1 parent 2d69ce1 commit deda8ac
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
run: |
kubectl cluster-info
echo "current-context:" $(kubectl config current-context)
helm upgrade --install --create-namespace --namespace terraform terraform-controller ./chart --set image.tag=e2e --set image.pullPolicy=IfNotPresent --set backend.namespace=terraform
helm upgrade --install --create-namespace --namespace terraform terraform-controller ./chart --set image.tag=e2e --set image.pullPolicy=IfNotPresent --set backend.namespace=terraform --wait
helm test -n terraform terraform-controller --timeout 5m
kubectl get pod -n terraform -l "app=terraform-controller"
Expand Down
1 change: 0 additions & 1 deletion api/types/meta.go

This file was deleted.

7 changes: 3 additions & 4 deletions controllers/process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ type Option func(spec v1beta2.Configuration, meta *TFConfigurationMeta)
// ControllerNamespaceOption will set the controller namespace for TFConfigurationMeta
func ControllerNamespaceOption(controllerNamespace string) Option {
return func(configuration v1beta2.Configuration, meta *TFConfigurationMeta) {
if controllerNamespace == "" {
return
}
uid := string(configuration.GetUID())
// @step: since we are using a single namespace to run these, we must ensure the names
// are unique across the namespace
Expand Down Expand Up @@ -282,10 +285,6 @@ func (meta *TFConfigurationMeta) assembleTerraformJob(executionType TerraformExe
Name: BackendVolumeName,
MountPath: BackendVolumeMountPath,
},
{
Name: GitAuthConfigVolumeName,
MountPath: GitAuthConfigVolumeMountPath,
},
}

if meta.TerraformCredentialsSecretReference != nil {
Expand Down
2 changes: 1 addition & 1 deletion controllers/process/process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ func TestIsTFStateGenerated(t *testing.T) {
meta: meta3,
},
want: want{
generated: false,
generated: true,
},
},
"outputs in the backend secret are not empty": {
Expand Down
14 changes: 9 additions & 5 deletions e2e/normal/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ func testBase(t *testing.T, configuration ConfigurationAttr, injector Injector,
klog.Infof("%s test begins……", configuration.Name)

waitConfigurationAvailable := func(ctx *TestContext) {
for i := 0; i < 120; i++ {
for i := 0; i < 60; i++ {
var fields []string
output, err := exec.Command("bash", "-c", "kubectl get configuration").CombinedOutput()
assert.NilError(t, err)
t.Log("get configuration\n", string(output))

lines := strings.Split(string(output), "\n")
for i, line := range lines {
Expand All @@ -91,11 +92,14 @@ func testBase(t *testing.T, configuration ConfigurationAttr, injector Injector,
}
output, err = exec.Command("bash", "-c", "kubectl get pod").CombinedOutput()
lines = strings.Split(string(output), "\n")
t.Log(string(output))
if i == 119 {
t.Error("Configuration is not ready")
t.Log("get pod\n", string(output))
if i == 59 {
t.Error("Configuration is not ready, getting controller's log")
output, err = exec.Command("bash", "-c", "kubectl logs -n terraform deploy/terraform-controller").CombinedOutput()
assert.NilError(t, err)
t.Log(string(output))
}
time.Sleep(time.Second * 5)
time.Sleep(time.Second * 2)
}
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/oam-dev/terraform-controller
go 1.17

require (
github.com/agiledragon/gomonkey/v2 v2.4.0
github.com/agiledragon/gomonkey/v2 v2.9.0
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1384
github.com/aws/aws-sdk-go v1.44.23
github.com/ghodss/yaml v1.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdko
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/agiledragon/gomonkey/v2 v2.4.0 h1:YDQJYiSQ8o78dCMXehU1E4F/Kh4jPX+MV+/iK/yfL7s=
github.com/agiledragon/gomonkey/v2 v2.4.0/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY=
github.com/agiledragon/gomonkey/v2 v2.9.0 h1:PDiKKybR596O6FHW+RVSG0Z7uGCBNbmbUXh3uCNQ7Hc=
github.com/agiledragon/gomonkey/v2 v2.9.0/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
Expand Down

0 comments on commit deda8ac

Please sign in to comment.