Skip to content

Commit ac79ec5

Browse files
committed
debug
Signed-off-by: Yuji Ito <[email protected]>
1 parent 8f07c9b commit ac79ec5

File tree

3 files changed

+24
-27
lines changed

3 files changed

+24
-27
lines changed

test/e2e/Makefile

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ create-loop-dev:
8888
setup-fin-volume: $(MINIKUBE_BIN) $(KUBECTL)
8989
for node in $(MINIKUBE_PROFILE_NAME) $(MINIKUBE_PROFILE_NAME)-m02; do \
9090
$(MINIKUBE) ssh -n $$node -- sudo dd if=/dev/zero of=fin-volume.img bs=1G seek=1 count=0; \
91-
$(MINIKUBE) ssh -n $$node -- sudo losetup /dev/loop1 fin-volume.img || :; \
92-
$(MINIKUBE) ssh -n $$node -- sudo mkfs.xfs /dev/loop1 || :; \
91+
$(MINIKUBE) ssh -n $$node -- sudo losetup $(FIN_VOLUME_LOOP_DEV) fin-volume.img || :; \
92+
$(MINIKUBE) ssh -n $$node -- sudo mkfs.xfs $(FIN_VOLUME_LOOP_DEV) || :; \
9393
$(MINIKUBE) ssh -n $$node -- sudo mkdir -p /fin; \
94-
$(MINIKUBE) ssh -n $$node -- sudo mount /dev/loop1 /fin; \
94+
$(MINIKUBE) ssh -n $$node -- sudo mount $(FIN_VOLUME_LOOP_DEV) /fin; \
9595
$(MINIKUBE) ssh -n $$node -- sudo chown -R 10000:10000 /fin; \
9696
$(MINIKUBE) ssh -n $$node -- ls -ld /fin; \
9797
done
@@ -149,6 +149,7 @@ setup-components:
149149
# Disable webhooks for e2e tests
150150
$(KUBECTL) -n $(NS) set env deployment/fin-controller-manager ENABLE_WEBHOOKS=false
151151
$(KUBECTL) patch deploy -n $(NS) fin-controller-manager --type='json' -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value":"--raw-img-expansion-unit-size=10485760"}]'
152+
$(KUBECTL) wait -n $(NS) --timeout=60s --for=condition=available deployment/fin-controller-manager
152153

153154
.PHONY: do-test
154155
do-test: $(GINKGO) $(KUBECTL) $(MINIKUBE_BIN)
@@ -157,4 +158,13 @@ do-test: $(GINKGO) $(KUBECTL) $(MINIKUBE_BIN)
157158
E2ETEST=1 \
158159
KUBECTL=$(KUBECTL) \
159160
MINIKUBE=$(MINIKUBE) \
160-
$(GINKGO) --fail-fast -v $(GINKGO_FLAGS) .
161+
$(GINKGO) --fail-fast -v $(GINKGO_FLAGS) .; \
162+
if [ "$$?" -ne 0 ]; then \
163+
echo "pods"; \
164+
$(KUBECTL) get pod -A; \
165+
echo "deployments"; \
166+
$(KUBECTL) get deploy -A; \
167+
echo "Controller logs"; \
168+
$(KUBECTL) -n rook-ceph logs deployment/fin-controller-manager; \
169+
exit 1; \
170+
fi

test/e2e/lock_test.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
. "github.com/onsi/ginkgo/v2"
1111
. "github.com/onsi/gomega"
1212
corev1 "k8s.io/api/core/v1"
13-
"sigs.k8s.io/controller-runtime/pkg/client"
1413
)
1514

1615
func lockTestSuite() {
@@ -26,8 +25,8 @@ func lockTestSuite() {
2625
Expect(err).NotTo(HaveOccurred())
2726

2827
pvc = CreateBackupTargetPVC(ctx, k8sClient, ns, "Filesystem", rookStorageClass, "ReadWriteOnce", "100Mi")
29-
pvc, err = WaitForPVCBound(ctx, ctrlClient, pvc, 1*time.Minute)
30-
Expect(err).NotTo(HaveOccurred())
28+
// Create a Pod to make filesystem to pass verification during backup
29+
_ = CreatePodForFilesystemPVC(ctx, k8sClient, pvc)
3130
})
3231

3332
It("should lock the volume", func(ctx SpecContext) {
@@ -49,13 +48,8 @@ func lockTestSuite() {
4948
err = CreateFinBackup(ctx, ctrlClient, fb)
5049
Expect(err).NotTo(HaveOccurred())
5150

52-
// renew fb to get UID
53-
currentFB := &finv1.FinBackup{}
54-
err = ctrlClient.Get(ctx, client.ObjectKeyFromObject(fb), currentFB)
55-
Expect(err).NotTo(HaveOccurred())
56-
5751
err = WaitControllerLog(ctx,
58-
"the volume is locked by another process.*"+string(currentFB.GetUID()),
52+
"the volume is locked by another process.*"+fb.GetName(),
5953
3*time.Minute)
6054
Expect(err).NotTo(HaveOccurred())
6155
})

test/e2e/util_test.go

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -378,19 +378,6 @@ func DeleteFinRestore(ctx context.Context, client client.Client, finrestore *fin
378378
return client.Delete(ctx, target)
379379
}
380380

381-
func WaitForPVCBound(ctx context.Context, c client.Client, pvc *corev1.PersistentVolumeClaim, timeout time.Duration) (*corev1.PersistentVolumeClaim, error) {
382-
GinkgoHelper()
383-
currentPVC := &corev1.PersistentVolumeClaim{}
384-
err := wait.PollUntilContextTimeout(ctx, time.Second, timeout, true, func(ctx context.Context) (bool, error) {
385-
err := c.Get(ctx, client.ObjectKeyFromObject(pvc), currentPVC)
386-
if err != nil {
387-
return false, err
388-
}
389-
return currentPVC.Status.Phase == corev1.ClaimBound, nil
390-
})
391-
return currentPVC, err
392-
}
393-
394381
func WaitForFinBackupStoredToNodeAndVerified(ctx context.Context, c client.Client, finbackup *finv1.FinBackup, timeout time.Duration) (*finv1.FinBackup, error) {
395382
GinkgoHelper()
396383
currentFB := &finv1.FinBackup{}
@@ -510,6 +497,7 @@ func WaitControllerLog(ctx SpecContext, pattern string, duration time.Duration)
510497
default:
511498
}
512499
line := scanner.Text()
500+
fmt.Println("⚠️ ", line)
513501
if matcher.MatchString(line) {
514502
close(found)
515503
return
@@ -755,7 +743,12 @@ func GetNodeNames(ctx context.Context, k8sClient kubernetes.Interface) ([]string
755743
func GetPvByPvc(ctx context.Context, k8sClient kubernetes.Interface, pvc *corev1.PersistentVolumeClaim) (*corev1.PersistentVolume, error) {
756744
GinkgoHelper()
757745

758-
return k8sClient.CoreV1().PersistentVolumes().Get(ctx, pvc.Spec.VolumeName, metav1.GetOptions{})
746+
currentPVC, err := k8sClient.CoreV1().PersistentVolumeClaims(pvc.Namespace).Get(ctx, pvc.Name, metav1.GetOptions{})
747+
if err != nil {
748+
return nil, err
749+
}
750+
751+
return k8sClient.CoreV1().PersistentVolumes().Get(ctx, currentPVC.Spec.VolumeName, metav1.GetOptions{})
759752
}
760753

761754
func ListRBDSnapshots(ctx context.Context, poolName, imageName string) ([]*model.RBDSnapshot, error) {

0 commit comments

Comments
 (0)