Skip to content

Commit

Permalink
log kyma, manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanxin committed Nov 26, 2024
1 parent 303492e commit 9daa6f8
Showing 1 changed file with 44 additions and 20 deletions.
64 changes: 44 additions & 20 deletions tests/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,29 +100,53 @@ var _ = BeforeSuite(func() {
Expect(err).ToNot(HaveOccurred(), "failed to run manager")
}()

go func() {
defer GinkgoRecover()
ticker := time.NewTicker(10 * time.Second)
defer ticker.Stop()
for {
select {
case <-ticker.C:
kcpKymaList := v1beta2.KymaList{}
err := kcpClient.List(ctx, &kcpKymaList)
if err == nil {
for _, kyma := range kcpKymaList.Items {
GinkgoWriter.Printf("kyma (%s) in cluster: Spec: %+v, Status: %+v\n", kyma.Name, kyma.Spec,
kyma.Status)
}
} else {
GinkgoWriter.Printf("error listing kcpKymaList: %v\n", err)
go logKymaInstances(ctx, kcpClient)
go logManifestInstances(ctx, kcpClient)
})

func logKymaInstances(ctx context.Context, kcpClient client.Client) {
ticker := time.NewTicker(30 * time.Second)
defer ticker.Stop()
for {
select {
case <-ticker.C:
kcpKymaList := v1beta2.KymaList{}
err := kcpClient.List(ctx, &kcpKymaList)
if err == nil {
for _, kyma := range kcpKymaList.Items {
GinkgoWriter.Printf("kyma (%s) in cluster: Spec: %+v, Status: %+v\n", kyma.Name, kyma.Spec,
kyma.Status)
}
case <-ctx.Done():
return
} else {
GinkgoWriter.Printf("error listing kcpKymaList: %v\n", err)
}
case <-ctx.Done():
return
}
}()
})
}
}

func logManifestInstances(ctx context.Context, kcpClient client.Client) {
ticker := time.NewTicker(30 * time.Second)
defer ticker.Stop()
for {
select {
case <-ticker.C:
manifestList := v1beta2.ManifestList{}
err := kcpClient.List(ctx, &manifestList)
if err == nil {
for _, manifest := range manifestList.Items {
GinkgoWriter.Printf("manifest (%s) in cluster: Spec: %+v, Status: %+v\n", manifest.Name,
manifest.Spec, manifest.Status)
}
} else {
GinkgoWriter.Printf("error listing manifestList: %v\n", err)
}
case <-ctx.Done():
return
}
}
}

var _ = AfterSuite(func() {
By("Print out all remaining resources for debugging")
Expand Down

0 comments on commit 9daa6f8

Please sign in to comment.