How to use By method of ginkgo Package

Best Ginkgo code snippet using ginkgo.By

actuation.go

Source:actuation.go Github

copy

Full Screen

...38)39var _ = ActuationSuiteE2eDescribe("Actuation", func() {40 f := framework.NewDefaultFramework("vertical-pod-autoscaling")41 ginkgo.It("stops when pods get pending", func() {42 ginkgo.By("Setting up a hamster deployment")43 d := SetupHamsterDeployment(f, "100m", "100Mi", defaultHamsterReplicas)44 ginkgo.By("Setting up a VPA CRD with ridiculous request")45 SetupVPA(f, "9999", vpa_types.UpdateModeAuto, hamsterTargetRef) // Request 9999 CPUs to make POD pending46 ginkgo.By("Waiting for pods to be restarted and stuck pending")47 err := assertPodsPendingForDuration(f.ClientSet, d, 1, 2*time.Minute)48 gomega.Expect(err).NotTo(gomega.HaveOccurred())49 })50 ginkgo.It("never applies recommendations when update mode is Off", func() {51 ginkgo.By("Setting up a hamster deployment")52 d := SetupHamsterDeployment(f, "100m", "100Mi", defaultHamsterReplicas)53 cpuRequest := getCPURequest(d.Spec.Template.Spec)54 podList, err := GetHamsterPods(f)55 gomega.Expect(err).NotTo(gomega.HaveOccurred())56 podSet := MakePodSet(podList)57 ginkgo.By("Setting up a VPA CRD in mode Off")58 SetupVPA(f, "200m", vpa_types.UpdateModeOff, hamsterTargetRef)59 ginkgo.By(fmt.Sprintf("Waiting for pods to be evicted, hoping it won't happen, sleep for %s", VpaEvictionTimeout.String()))60 CheckNoPodsEvicted(f, podSet)61 ginkgo.By("Forcefully killing one pod")62 killPod(f, podList)63 ginkgo.By("Checking the requests were not modified")64 updatedPodList, err := GetHamsterPods(f)65 for _, pod := range updatedPodList.Items {66 gomega.Expect(getCPURequest(pod.Spec)).To(gomega.Equal(cpuRequest))67 }68 })69 ginkgo.It("applies recommendations only on restart when update mode is Initial", func() {70 ginkgo.By("Setting up a hamster deployment")71 SetupHamsterDeployment(f, "100m", "100Mi", defaultHamsterReplicas)72 podList, err := GetHamsterPods(f)73 gomega.Expect(err).NotTo(gomega.HaveOccurred())74 podSet := MakePodSet(podList)75 ginkgo.By("Setting up a VPA CRD in mode Initial")76 SetupVPA(f, "200m", vpa_types.UpdateModeInitial, hamsterTargetRef)77 updatedCPURequest := ParseQuantityOrDie("200m")78 ginkgo.By(fmt.Sprintf("Waiting for pods to be evicted, hoping it won't happen, sleep for %s", VpaEvictionTimeout.String()))79 CheckNoPodsEvicted(f, podSet)80 ginkgo.By("Forcefully killing one pod")81 killPod(f, podList)82 ginkgo.By("Checking that request was modified after forceful restart")83 updatedPodList, err := GetHamsterPods(f)84 foundUpdated := 085 for _, pod := range updatedPodList.Items {86 podRequest := getCPURequest(pod.Spec)87 framework.Logf("podReq: %v", podRequest)88 if podRequest.Cmp(updatedCPURequest) == 0 {89 foundUpdated += 190 }91 }92 gomega.Expect(foundUpdated).To(gomega.Equal(1))93 })94 ginkgo.It("evicts pods in a Deployment", func() {95 testEvictsPods(f, &autoscaling.CrossVersionObjectReference{96 APIVersion: "apps/v1",97 Kind: "Deployment",98 Name: "hamster-deployment",99 })100 })101 ginkgo.It("evicts pods in a Replication Controller", func() {102 testEvictsPods(f, &autoscaling.CrossVersionObjectReference{103 APIVersion: "v1",104 Kind: "ReplicationController",105 Name: "hamster-rc",106 })107 })108 ginkgo.It("evicts pods in a Job", func() {109 testEvictsPods(f, &autoscaling.CrossVersionObjectReference{110 APIVersion: "batch/v1",111 Kind: "Job",112 Name: "hamster-job",113 })114 })115 ginkgo.It("evicts pods in a CronJob", func() {116 testEvictsPods(f, &autoscaling.CrossVersionObjectReference{117 APIVersion: "batch/v1",118 Kind: "CronJob",119 Name: "hamster-cronjob",120 })121 })122 ginkgo.It("evicts pods in a ReplicaSet", func() {123 testEvictsPods(f, &autoscaling.CrossVersionObjectReference{124 APIVersion: "apps/v1",125 Kind: "ReplicaSet",126 Name: "hamster-rs",127 })128 })129 ginkgo.It("evicts pods in a StatefulSet", func() {130 testEvictsPods(f, &autoscaling.CrossVersionObjectReference{131 APIVersion: "apps/v1",132 Kind: "StatefulSet",133 Name: "hamster-stateful",134 })135 })136 ginkgo.It("observes pod disruption budget", func() {137 ginkgo.By("Setting up a hamster deployment")138 c := f.ClientSet139 ns := f.Namespace.Name140 SetupHamsterDeployment(f, "10m", "10Mi", 10)141 podList, err := GetHamsterPods(f)142 gomega.Expect(err).NotTo(gomega.HaveOccurred())143 podSet := MakePodSet(podList)144 ginkgo.By("Setting up prohibitive PDB for hamster deployment")145 pdb := setupPDB(f, "hamster-pdb", 0 /* maxUnavailable */)146 ginkgo.By("Setting up a VPA CRD")147 SetupVPA(f, "25m", vpa_types.UpdateModeAuto, hamsterTargetRef)148 ginkgo.By(fmt.Sprintf("Waiting for pods to be evicted, hoping it won't happen, sleep for %s", VpaEvictionTimeout.String()))149 CheckNoPodsEvicted(f, podSet)150 ginkgo.By("Updating the PDB to allow for multiple pods to be evicted")151 // We will check that 7 replicas are evicted in 3 minutes, which translates152 // to 3 updater loops. This gives us relatively good confidence that updater153 // evicts more than one pod in a loop if PDB allows it.154 permissiveMaxUnavailable := 7155 // Creating new PDB and removing old one, since PDBs are immutable at the moment156 setupPDB(f, "hamster-pdb-2", permissiveMaxUnavailable)157 err = c.PolicyV1beta1().PodDisruptionBudgets(ns).Delete(pdb.Name, &metav1.DeleteOptions{})158 gomega.Expect(err).NotTo(gomega.HaveOccurred())159 ginkgo.By(fmt.Sprintf("Waiting for pods to be evicted, sleep for %s", VpaEvictionTimeout.String()))160 time.Sleep(VpaEvictionTimeout)161 ginkgo.By("Checking enough pods were evicted.")162 currentPodList, err := GetHamsterPods(f)163 gomega.Expect(err).NotTo(gomega.HaveOccurred())164 evictedCount := GetEvictedPodsCount(MakePodSet(currentPodList), podSet)165 gomega.Expect(err).NotTo(gomega.HaveOccurred())166 gomega.Expect(evictedCount >= permissiveMaxUnavailable).To(gomega.BeTrue())167 })168 ginkgo.It("observes container max in LimitRange", func() {169 ginkgo.By("Setting up a hamster deployment")170 d := NewHamsterDeploymentWithResourcesAndLimits(f,171 ParseQuantityOrDie("100m") /*cpu request*/, ParseQuantityOrDie("200Mi"), /*memory request*/172 ParseQuantityOrDie("300m") /*cpu limit*/, ParseQuantityOrDie("400Mi") /*memory limit*/)173 podList := startDeploymentPods(f, d)174 ginkgo.By("Setting up a VPA CRD")175 SetupVPA(f, "200m", vpa_types.UpdateModeAuto, hamsterTargetRef)176 // Max CPU limit is 300m and ratio is 3., so max request is 100m, while177 // recommendation is 200m178 // Max memory limit is 1T and ratio is 2., so max request is 0.5T179 InstallLimitRangeWithMax(f, "300m", "1T", apiv1.LimitTypeContainer)180 ginkgo.By(fmt.Sprintf("Waiting for pods to be evicted, hoping it won't happen, sleep for %s", VpaEvictionTimeout.String()))181 CheckNoPodsEvicted(f, MakePodSet(podList))182 })183 ginkgo.It("observes container min in LimitRange", func() {184 ginkgo.By("Setting up a hamster deployment")185 d := NewHamsterDeploymentWithResourcesAndLimits(f,186 ParseQuantityOrDie("100m") /*cpu request*/, ParseQuantityOrDie("200Mi"), /*memory request*/187 ParseQuantityOrDie("300m") /*cpu limit*/, ParseQuantityOrDie("400Mi") /*memory limit*/)188 podList := startDeploymentPods(f, d)189 ginkgo.By("Setting up a VPA CRD")190 SetupVPA(f, "50m", vpa_types.UpdateModeAuto, hamsterTargetRef)191 // Min CPU from limit range is 100m and ratio is 3. Min applies both to limit and request so min192 // request is 100m request and 300m limit193 // Min memory limit is 0 and ratio is 2., so min request is 0194 InstallLimitRangeWithMin(f, "100m", "0", apiv1.LimitTypeContainer)195 ginkgo.By(fmt.Sprintf("Waiting for pods to be evicted, hoping it won't happen, sleep for %s", VpaEvictionTimeout.String()))196 CheckNoPodsEvicted(f, MakePodSet(podList))197 })198 ginkgo.It("observes pod max in LimitRange", func() {199 ginkgo.By("Setting up a hamster deployment")200 d := NewHamsterDeploymentWithResourcesAndLimits(f,201 ParseQuantityOrDie("100m") /*cpu request*/, ParseQuantityOrDie("200Mi"), /*memory request*/202 ParseQuantityOrDie("300m") /*cpu limit*/, ParseQuantityOrDie("400Mi") /*memory limit*/)203 d.Spec.Template.Spec.Containers = append(d.Spec.Template.Spec.Containers, d.Spec.Template.Spec.Containers[0])204 d.Spec.Template.Spec.Containers[1].Name = "hamster2"205 podList := startDeploymentPods(f, d)206 ginkgo.By("Setting up a VPA CRD")207 SetupVPAForNHamsters(f, 2, "200m", vpa_types.UpdateModeAuto, hamsterTargetRef)208 // Max CPU limit is 600m per pod, 300m per container and ratio is 3., so max request is 100m,209 // while recommendation is 200m210 // Max memory limit is 2T per pod, 1T per container and ratio is 2., so max request is 0.5T211 InstallLimitRangeWithMax(f, "600m", "2T", apiv1.LimitTypePod)212 ginkgo.By(fmt.Sprintf("Waiting for pods to be evicted, hoping it won't happen, sleep for %s", VpaEvictionTimeout.String()))213 CheckNoPodsEvicted(f, MakePodSet(podList))214 })215 ginkgo.It("observes pod min in LimitRange", func() {216 ginkgo.By("Setting up a hamster deployment")217 d := NewHamsterDeploymentWithResourcesAndLimits(f,218 ParseQuantityOrDie("100m") /*cpu request*/, ParseQuantityOrDie("200Mi"), /*memory request*/219 ParseQuantityOrDie("300m") /*cpu limit*/, ParseQuantityOrDie("400Mi") /*memory limit*/)220 d.Spec.Template.Spec.Containers = append(d.Spec.Template.Spec.Containers, d.Spec.Template.Spec.Containers[0])221 d.Spec.Template.Spec.Containers[1].Name = "hamster2"222 podList := startDeploymentPods(f, d)223 ginkgo.By("Setting up a VPA CRD")224 SetupVPAForNHamsters(f, 2, "50m", vpa_types.UpdateModeAuto, hamsterTargetRef)225 // Min CPU from limit range is 200m per pod, 100m per container and ratio is 3. Min applies both226 // to limit and request so min request is 100m request and 300m limit227 // Min memory limit is 0 and ratio is 2., so min request is 0228 InstallLimitRangeWithMin(f, "200m", "0", apiv1.LimitTypePod)229 ginkgo.By(fmt.Sprintf("Waiting for pods to be evicted, hoping it won't happen, sleep for %s", VpaEvictionTimeout.String()))230 CheckNoPodsEvicted(f, MakePodSet(podList))231 })232 ginkgo.It("does not act on injected sidecars", func() {233 const (234 // TODO(krzysied): Update the image url when the agnhost:2.10 image235 // is promoted to the k8s-e2e-test-images repository.236 agnhostImage = "gcr.io/k8s-staging-e2e-test-images/agnhost:2.10"237 sidecarParam = "--sidecar-image=k8s.gcr.io/pause:3.1"238 sidecarName = "webhook-added-sidecar"239 servicePort = int32(8443)240 containerPort = int32(8444)241 )242 ginkgo.By("Setting up Webhook for sidecar injection")243 client := f.ClientSet244 namespaceName := f.Namespace.Name245 defer utils.CleanWebhookTest(client, namespaceName)246 // Make sure the namespace created for the test is labeled to be selected by the webhooks.247 utils.LabelNamespace(f, f.Namespace.Name)248 utils.CreateWebhookConfigurationReadyNamespace(f)249 ginkgo.By("Setting up server cert")250 context := utils.SetupWebhookCert(namespaceName)251 utils.CreateAuthReaderRoleBinding(f, namespaceName)252 utils.DeployWebhookAndService(f, agnhostImage, context, servicePort, containerPort, sidecarParam)253 // Webhook must be placed after vpa webhook. Webhooks are registered alphabetically.254 // Use name that starts with "z".255 webhookCleanup := utils.RegisterMutatingWebhookForPod(f, "z-sidecar-injection-webhook", context, servicePort)256 defer webhookCleanup()257 ginkgo.By("Setting up a hamster vpa")258 mode := vpa_types.UpdateModeAuto259 hamsterResourceList := apiv1.ResourceList{apiv1.ResourceCPU: ParseQuantityOrDie("100m")}260 sidecarResourceList := apiv1.ResourceList{apiv1.ResourceCPU: ParseQuantityOrDie("5000m")}261 vpaCRD := NewVPA(f, "hamster-vpa", hamsterTargetRef)262 vpaCRD.Spec.UpdatePolicy.UpdateMode = &mode263 vpaCRD.Status.Recommendation = &vpa_types.RecommendedPodResources{264 ContainerRecommendations: []vpa_types.RecommendedContainerResources{265 {266 ContainerName: GetHamsterContainerNameByIndex(0),267 Target: hamsterResourceList,268 LowerBound: hamsterResourceList,269 UpperBound: hamsterResourceList,270 },271 {272 ContainerName: sidecarName,273 Target: sidecarResourceList,274 LowerBound: sidecarResourceList,275 UpperBound: sidecarResourceList,276 },277 },278 }279 InstallVPA(f, vpaCRD)280 ginkgo.By("Setting up a hamster deployment")281 d := NewHamsterDeploymentWithResources(f, ParseQuantityOrDie("100m"), ParseQuantityOrDie("100Mi"))282 podList := startDeploymentPods(f, d)283 for _, pod := range podList.Items {284 observedContainers, ok := pod.GetAnnotations()[annotations.VpaObservedContainersLabel]285 gomega.Expect(ok).To(gomega.Equal(true))286 containers, err := annotations.ParseVpaObservedContainersValue(observedContainers)287 gomega.Expect(err).NotTo(gomega.HaveOccurred())288 gomega.Expect(containers).To(gomega.HaveLen(1))289 gomega.Expect(pod.Spec.Containers).To(gomega.HaveLen(2))290 }291 podSet := MakePodSet(podList)292 ginkgo.By(fmt.Sprintf("Waiting for pods to be evicted, hoping it won't happen, sleep for %s", VpaEvictionTimeout.String()))293 CheckNoPodsEvicted(f, podSet)294 })295})296func getCPURequest(podSpec apiv1.PodSpec) resource.Quantity {297 return podSpec.Containers[0].Resources.Requests[apiv1.ResourceCPU]298}299func killPod(f *framework.Framework, podList *apiv1.PodList) {300 f.ClientSet.CoreV1().Pods(f.Namespace.Name).Delete(podList.Items[0].Name, &metav1.DeleteOptions{})301 err := WaitForPodsRestarted(f, podList)302 gomega.Expect(err).NotTo(gomega.HaveOccurred())303}304// assertPodsPendingForDuration checks that at most pendingPodsNum pods are pending for pendingDuration305func assertPodsPendingForDuration(c clientset.Interface, deployment *appsv1.Deployment, pendingPodsNum int, pendingDuration time.Duration) error {306 pendingPods := make(map[string]time.Time)307 err := wait.PollImmediate(pollInterval, pollTimeout+pendingDuration, func() (bool, error) {308 var err error309 currentPodList, err := framework_deployment.GetPodsForDeployment(c, deployment)310 if err != nil {311 return false, err312 }313 missingPods := make(map[string]bool)314 for podName := range pendingPods {315 missingPods[podName] = true316 }317 now := time.Now()318 for _, pod := range currentPodList.Items {319 delete(missingPods, pod.Name)320 switch pod.Status.Phase {321 case apiv1.PodPending:322 _, ok := pendingPods[pod.Name]323 if !ok {324 pendingPods[pod.Name] = now325 }326 default:327 delete(pendingPods, pod.Name)328 }329 }330 for missingPod := range missingPods {331 delete(pendingPods, missingPod)332 }333 if len(pendingPods) < pendingPodsNum {334 return false, nil335 }336 if len(pendingPods) > pendingPodsNum {337 return false, fmt.Errorf("%v pending pods seen - expecting %v", len(pendingPods), pendingPodsNum)338 }339 for p, t := range pendingPods {340 fmt.Println("task", now, p, t, now.Sub(t), pendingDuration)341 if now.Sub(t) < pendingDuration {342 return false, nil343 }344 }345 return true, nil346 })347 if err != nil {348 return fmt.Errorf("assertion failed for pending pods in %v: %v", deployment.Name, err)349 }350 return nil351}352func testEvictsPods(f *framework.Framework, controller *autoscaling.CrossVersionObjectReference) {353 ginkgo.By(fmt.Sprintf("Setting up a hamster %v", controller.Kind))354 setupHamsterController(f, controller.Kind, "100m", "100Mi", defaultHamsterReplicas)355 podList, err := GetHamsterPods(f)356 gomega.Expect(err).NotTo(gomega.HaveOccurred())357 ginkgo.By("Setting up a VPA CRD")358 SetupVPA(f, "200m", vpa_types.UpdateModeAuto, controller)359 ginkgo.By("Waiting for pods to be evicted")360 err = WaitForPodsEvicted(f, podList)361 gomega.Expect(err).NotTo(gomega.HaveOccurred())362}363func setupHamsterController(f *framework.Framework, controllerKind, cpu, memory string, replicas int32) *apiv1.PodList {364 switch controllerKind {365 case "Deployment":366 SetupHamsterDeployment(f, cpu, memory, replicas)367 case "ReplicationController":368 setupHamsterReplicationController(f, cpu, memory, replicas)369 case "Job":370 setupHamsterJob(f, cpu, memory, replicas)371 case "CronJob":372 SetupHamsterCronJob(f, "*/2 * * * *", cpu, memory, replicas)373 case "ReplicaSet":374 setupHamsterRS(f, cpu, memory, replicas)375 case "StatefulSet":376 setupHamsterStateful(f, cpu, memory, replicas)377 default:378 framework.Failf("Unknown controller kind: %v", controllerKind)379 return nil380 }381 pods, err := GetHamsterPods(f)382 gomega.Expect(err).NotTo(gomega.HaveOccurred())383 return pods384}385func setupHamsterReplicationController(f *framework.Framework, cpu, memory string, replicas int32) {386 hamsterContainer := SetupHamsterContainer(cpu, memory)387 rc := framework.RcByNameContainer("hamster-rc", replicas, "k8s.gcr.io/ubuntu-slim:0.1",388 hamsterLabels, hamsterContainer, nil)389 rc.Namespace = f.Namespace.Name390 err := testutils.CreateRCWithRetries(f.ClientSet, f.Namespace.Name, rc)391 gomega.Expect(err).NotTo(gomega.HaveOccurred())392 err = waitForRCPodsRunning(f, rc)393 gomega.Expect(err).NotTo(gomega.HaveOccurred())394}395func waitForRCPodsRunning(f *framework.Framework, rc *apiv1.ReplicationController) error {396 return wait.PollImmediate(pollInterval, pollTimeout, func() (bool, error) {397 podList, err := GetHamsterPods(f)398 if err != nil {399 framework.Logf("Error listing pods, retrying: %v", err)400 return false, nil401 }...

Full Screen

Full Screen

dynamic_certificates.go

Source:dynamic_certificates.go Github

copy

Full Screen

...68 ing.Spec.TLS[0].SecretName,69 ing.Namespace)70 assert.Nil(ginkgo.GinkgoT(), err)71 time.Sleep(waitForLuaSync)72 ginkgo.By("serving the configured certificate on HTTPS endpoint")73 ensureHTTPSRequest(f, f.GetURL(framework.HTTPS), host, host)74 log, err := f.NginxLogs()75 assert.Nil(ginkgo.GinkgoT(), err)76 assert.NotEmpty(ginkgo.GinkgoT(), log)77 ginkgo.By("skipping Nginx reload")78 mf, err = f.GetMetric("nginx_ingress_controller_success", ip)79 assert.Nil(ginkgo.GinkgoT(), err)80 assert.NotNil(ginkgo.GinkgoT(), mf)81 rc1, err := extractReloadCount(mf)82 assert.Nil(ginkgo.GinkgoT(), err)83 assert.Equal(ginkgo.GinkgoT(), rc0, rc1)84 })85 ginkgo.Context("given an ingress with TLS correctly configured", func() {86 ginkgo.BeforeEach(func() {87 ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, framework.EchoService, 80, nil))88 time.Sleep(waitForLuaSync)89 ensureHTTPSRequest(f, f.GetURL(framework.HTTPS), host, "ingress.local")90 _, err := framework.CreateIngressTLSSecret(f.KubeClientSet,91 ing.Spec.TLS[0].Hosts,92 ing.Spec.TLS[0].SecretName,93 ing.Namespace)94 assert.Nil(ginkgo.GinkgoT(), err)95 time.Sleep(waitForLuaSync)96 ginkgo.By("configuring certificate_by_lua and skipping Nginx configuration of the new certificate")97 f.WaitForNginxServer(ing.Spec.TLS[0].Hosts[0],98 func(server string) bool {99 return strings.Contains(server, "listen 443")100 })101 time.Sleep(waitForLuaSync)102 ginkgo.By("serving the configured certificate on HTTPS endpoint")103 ensureHTTPSRequest(f, f.GetURL(framework.HTTPS), host, host)104 })105 /*106 TODO(elvinefendi): this test currently does not work as expected107 because Go transport code strips (https://github.com/golang/go/blob/431b5c69ca214ce4291f008c1ce2a50b22bc2d2d/src/crypto/tls/handshake_messages.go#L424)108 trailing dot from SNI as suggest by the standard (https://tools.ietf.org/html/rfc6066#section-3).109 */110 ginkgo.It("supports requests with domain with trailing dot", func() {111 ensureHTTPSRequest(f, f.GetURL(framework.HTTPS), host+".", host)112 })113 ginkgo.It("picks up the updated certificate without reloading", func() {114 ing, err := f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Get(context.TODO(), host, metav1.GetOptions{})115 assert.Nil(ginkgo.GinkgoT(), err)116 ensureHTTPSRequest(f, fmt.Sprintf("%s?id=dummy_log_splitter_foo_bar", f.GetURL(framework.HTTPS)), host, host)117 _, err = framework.CreateIngressTLSSecret(f.KubeClientSet,118 ing.Spec.TLS[0].Hosts,119 ing.Spec.TLS[0].SecretName,120 ing.Namespace)121 assert.Nil(ginkgo.GinkgoT(), err)122 time.Sleep(waitForLuaSync)123 ginkgo.By("configuring certificate_by_lua and skipping Nginx configuration of the new certificate")124 f.WaitForNginxServer(ing.Spec.TLS[0].Hosts[0],125 func(server string) bool {126 return strings.Contains(server, "listen 443")127 })128 ginkgo.By("serving the configured certificate on HTTPS endpoint")129 ensureHTTPSRequest(f, f.GetURL(framework.HTTPS), host, host)130 log, err := f.NginxLogs()131 assert.Nil(ginkgo.GinkgoT(), err)132 assert.NotEmpty(ginkgo.GinkgoT(), log)133 index := strings.Index(log, "id=dummy_log_splitter_foo_bar")134 assert.GreaterOrEqual(ginkgo.GinkgoT(), index, 0, "log does not contains id=dummy_log_splitter_foo_bar")135 restOfLogs := log[index:]136 ginkgo.By("skipping Nginx reload")137 assert.NotContains(ginkgo.GinkgoT(), restOfLogs, logRequireBackendReload)138 assert.NotContains(ginkgo.GinkgoT(), restOfLogs, logBackendReloadSuccess)139 })140 ginkgo.It("falls back to using default certificate when secret gets deleted without reloading", func() {141 ing, err := f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Get(context.TODO(), host, metav1.GetOptions{})142 assert.Nil(ginkgo.GinkgoT(), err)143 ensureHTTPSRequest(f, fmt.Sprintf("%s?id=dummy_log_splitter_foo_bar", f.GetURL(framework.HTTPS)), host, host)144 ip := f.GetNginxPodIP()145 mf, err := f.GetMetric("nginx_ingress_controller_success", ip)146 assert.Nil(ginkgo.GinkgoT(), err)147 assert.NotNil(ginkgo.GinkgoT(), mf)148 rc0, err := extractReloadCount(mf)149 assert.Nil(ginkgo.GinkgoT(), err)150 err = f.KubeClientSet.CoreV1().Secrets(ing.Namespace).Delete(context.TODO(), ing.Spec.TLS[0].SecretName, metav1.DeleteOptions{})151 assert.Nil(ginkgo.GinkgoT(), err)152 time.Sleep(waitForLuaSync)153 ginkgo.By("serving the default certificate on HTTPS endpoint")154 ensureHTTPSRequest(f, f.GetURL(framework.HTTPS), host, "ingress.local")155 mf, err = f.GetMetric("nginx_ingress_controller_success", ip)156 assert.Nil(ginkgo.GinkgoT(), err)157 assert.NotNil(ginkgo.GinkgoT(), mf)158 rc1, err := extractReloadCount(mf)159 assert.Nil(ginkgo.GinkgoT(), err)160 ginkgo.By("skipping Nginx reload")161 assert.Equal(ginkgo.GinkgoT(), rc0, rc1)162 })163 ginkgo.It("picks up a non-certificate only change", func() {164 newHost := "foo2.com"165 ing, err := f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Get(context.TODO(), host, metav1.GetOptions{})166 assert.Nil(ginkgo.GinkgoT(), err)167 ing.Spec.Rules[0].Host = newHost168 _, err = f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Update(context.TODO(), ing, metav1.UpdateOptions{})169 assert.Nil(ginkgo.GinkgoT(), err)170 time.Sleep(waitForLuaSync)171 ginkgo.By("serving the configured certificate on HTTPS endpoint")172 ensureHTTPSRequest(f, f.GetURL(framework.HTTPS), newHost, "ingress.local")173 })174 ginkgo.It("removes HTTPS configuration when we delete TLS spec", func() {175 ing, err := f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Get(context.TODO(), host, metav1.GetOptions{})176 assert.Nil(ginkgo.GinkgoT(), err)177 ing.Spec.TLS = []networking.IngressTLS{}178 _, err = f.KubeClientSet.NetworkingV1beta1().Ingresses(f.Namespace).Update(context.TODO(), ing, metav1.UpdateOptions{})179 assert.Nil(ginkgo.GinkgoT(), err)180 time.Sleep(waitForLuaSync)181 f.HTTPTestClient().182 GET("/").183 WithHeader("Host", host).184 Expect().185 Status(http.StatusOK)...

Full Screen

Full Screen

By

Using AI Code Generation

copy

Full Screen

1By("Test")2It("Test")3Describe("Test")4Context("Test")5BeforeEach(func() {6Expect(1).To(Equal(1))7})8AfterEach(func() {9Expect(1).To(Equal(1))10})11BeforeSuite(func() {12Expect(1).To(Equal(1))13})14AfterSuite(func() {15Expect(1).To(Equal(1))16})17JustBeforeEach(func() {18Expect(1).To(Equal(1))19})20JustAfterEach(func() {21Expect(1).To(Equal(1))22})23Measure("Test", func(b Benchmarker) {24Expect(1).To(Equal(1))25}, 1)26FIt("Test")27PIt("Test")28XIt("Test")29FDescribe("Test")30PDescribe("Test")31XDescribe("Test")32FContext("Test")33PContext("Test")34XContext("Test")

Full Screen

Full Screen

By

Using AI Code Generation

copy

Full Screen

1var _ = Describe("Test1", func() {2 var (3 BeforeEach(func() {4 })5 It("should add two numbers", func() {6 Expect(a + b).Should(Equal(3))7 })8})9var _ = Describe("Test2", func() {10 var (11 BeforeEach(func() {12 })13 It("should add two numbers", func() {14 Expect(a + b).Should(Equal(3))15 })16})17var _ = Describe("Test3", func() {18 var (19 BeforeEach(func() {20 })21 It("should add two numbers", func() {22 Expect(a + b).Should(Equal(3))23 })24})25var _ = Describe("Test4", func() {26 var (27 BeforeEach(func() {28 })29 It("should add two numbers", func() {30 Expect(a + b).Should(Equal(3))31 })32})33var _ = Describe("Test5", func() {34 var (35 BeforeEach(func() {36 })37 It("should add two numbers", func() {38 Expect(a + b).Should(Equal(3))39 })40})41var _ = Describe("Test6", func() {42 var (43 BeforeEach(func() {44 })45 It("should add two numbers", func() {46 Expect(a

Full Screen

Full Screen

By

Using AI Code Generation

copy

Full Screen

1Expect(1).To(ginkgo.BeNumerically("==", 1))2Expect(1).To(gomega.Equal(1))3Expect(1).To(gomega.BeNumerically("==", 1))4Expect(1).To(gomega.BeNumerically("==", 1))5Expect(1).To(gomega.Equal(1))6Expect(1).To(gomega.BeNumerically("==", 1))7Expect(1).To(gomega.BeNumerically("==", 1))8Expect(1).To(gomega.BeNumerically("==", 1))9Expect(1).To(gomega.BeNumerically("==", 1))10Expect(1).To(gomega.BeNumerically("==", 1))11Expect(1).To(gomega.BeNumerically("==", 1))12Expect(1).To(gomega.BeNumerically("==", 1))13Expect(1).To(gomega.BeNumerically("==", 1))14Expect(1).To(gomega.BeNumerically("==", 1))15Expect(1).To(gomega

Full Screen

Full Screen

By

Using AI Code Generation

copy

Full Screen

1By("Doing something")2It("should do something", func() {3 Expect(something).ShouldNot(BeNil())4})5By("Doing something")6It("should do something", func() {7 Expect(something).ShouldNot(BeNil())8})9By("Doing something")10It("should do something", func() {11 Expect(something).ShouldNot(BeNil())12})13By("Doing something")14It("should do something", func() {15 Expect(something).ShouldNot(BeNil())16})17By("Doing something")18It("should do something", func() {19 Expect(something).ShouldNot(BeNil())20})21By("Doing something")22It("should do something", func() {23 Expect(something).ShouldNot(BeNil())24})25By("Doing something")26It("should do something", func() {27 Expect(something).ShouldNot(BeNil())28})29By("Doing something")30It("should do something

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful