-
Notifications
You must be signed in to change notification settings - Fork 50
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
Clean conductors from db during rescaling #620
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,11 +15,15 @@ package functional_test | |
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"net/http" | ||
|
||
networkv1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
keystone_helper "github.com/openstack-k8s-operators/keystone-operator/api/test/helpers" | ||
. "github.com/openstack-k8s-operators/lib-common/modules/common/test/helpers" | ||
api "github.com/openstack-k8s-operators/lib-common/modules/test/apis" | ||
novav1 "github.com/openstack-k8s-operators/nova-operator/api/v1beta1" | ||
|
||
corev1 "k8s.io/api/core/v1" | ||
|
@@ -637,3 +641,47 @@ var _ = Describe("NovaConductor controller", func() { | |
}) | ||
}) | ||
}) | ||
|
||
var _ = Describe("NovaConductor controller cleaning", func() { | ||
var novaAPIServer *NovaAPIFixture | ||
BeforeEach(func() { | ||
novaAPIServer = NewNovaAPIFixtureWithServer(logger) | ||
novaAPIServer.Setup() | ||
f := keystone_helper.NewKeystoneAPIFixtureWithServer(logger) | ||
text := ResponseHandleToken(f.Endpoint(), novaAPIServer.Endpoint()) | ||
f.Setup( | ||
api.Handler{Pattern: "/", Func: f.HandleVersion}, | ||
api.Handler{Pattern: "/v3/users", Func: f.HandleUsers}, | ||
api.Handler{Pattern: "/v3/domains", Func: f.HandleDomains}, | ||
api.Handler{Pattern: "/v3/auth/tokens", Func: func(w http.ResponseWriter, r *http.Request) { | ||
switch r.Method { | ||
case "POST": | ||
w.Header().Add("Content-Type", "application/json") | ||
w.WriteHeader(202) | ||
fmt.Fprint(w, text) | ||
} | ||
}}) | ||
DeferCleanup(f.Cleanup) | ||
|
||
spec := GetDefaultNovaConductorSpec(cell0) | ||
spec["keystoneAuthURL"] = f.Endpoint() | ||
DeferCleanup(th.DeleteInstance, CreateNovaConductor(cell0.ConductorName, spec)) | ||
DeferCleanup( | ||
k8sClient.Delete, ctx, CreateCellInternalSecret(cell0)) | ||
th.SimulateJobSuccess(cell0.DBSyncJobName) | ||
th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) | ||
}) | ||
When("NovaConductor down service is removed from api", func() { | ||
It("during reconciling", func() { | ||
th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) | ||
th.ExpectCondition( | ||
cell0.ConductorName, | ||
ConditionGetterFunc(NovaConductorConditionGetter), | ||
condition.DeploymentReadyCondition, | ||
corev1.ConditionTrue, | ||
) | ||
Expect(novaAPIServer.FindRequest("GET", "/compute/os-services/", "binary=nova-conductor")).To(BeTrue()) | ||
Expect(novaAPIServer.FindRequest("DELETE", "/compute/os-services/3", "")).To(BeTrue()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that fixture records the query param please assert that the code queried a list of conductor services. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done a68cc8c There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cool. As a follow up add the same to the schedule test |
||
}) | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be generalized now as it only differs from the scheduler one by
Binary: "nova-conductor"
so that can be passed as a parameter and also the keystoneAuthURL can be taken as a parameter.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done a68cc8c