Skip to content
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

e2e_lvc #246

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pkg/components/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package components
import (
"context"
"fmt"
"strings"

appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"strings"

"go.ytsaurus.tech/library/go/ptr"
"go.ytsaurus.tech/yt/go/ypath"
Expand Down Expand Up @@ -70,6 +71,12 @@ func GetNotGoodTabletCellBundles(ctx context.Context, ytClient yt.Client) ([]str
return notGoodBundles, err
}

func GetLVCCount(ctx context.Context, ytClient yt.Client) (int, error) {
lvcCount := 0
err := ytClient.GetNode(ctx, ypath.Path("//sys/lost_vital_chunks/@count"), &lvcCount, nil)
return lvcCount, err
}

func CreateUser(ctx context.Context, ytClient yt.Client, userName, token string, isSuperuser bool) error {
var err error
_, err = ytClient.CreateObject(ctx, yt.NodeUser, &yt.CreateObjectOptions{
Expand Down
9 changes: 4 additions & 5 deletions pkg/components/ytsaurus_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"go.ytsaurus.tech/yt/go/yt/ythttp"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
ptr "k8s.io/utils/pointer"
"sigs.k8s.io/controller-runtime/pkg/log"

ytv1 "github.com/ytsaurus/yt-k8s-operator/api/v1"
"github.com/ytsaurus/yt-k8s-operator/pkg/apiproxy"
Expand Down Expand Up @@ -150,6 +151,7 @@

func (yc *YtsaurusClient) handleUpdatingState(ctx context.Context) (ComponentStatus, error) {
var err error
logger := log.FromContext(ctx)

switch yc.ytsaurus.GetUpdateState() {
case ytv1.UpdateStatePossibilityCheck:
Expand All @@ -162,6 +164,7 @@
}

if !ok {
logger.Info("possibility check has failed: " + msg)
yc.ytsaurus.SetUpdateStatusCondition(ctx, metav1.Condition{
Type: consts.ConditionNoPossibility,
Status: metav1.ConditionTrue,
Expand Down Expand Up @@ -429,11 +432,7 @@
}

// Check LVC.
lvcCount := 0
err = yc.ytClient.GetNode(ctx, ypath.Path("//sys/lost_vital_chunks/@count"), &lvcCount, nil)
if err != nil {
return
}
lvcCount, err := GetLVCCount(ctx, yc.ytClient)

Check failure on line 435 in pkg/components/ytsaurus_client.go

View workflow job for this annotation

GitHub Actions / Run checks

ineffectual assignment to err (ineffassign)

if lvcCount > 0 {
msg = fmt.Sprintf("There are lost vital chunks: %v", lvcCount)
Expand Down
9 changes: 9 additions & 0 deletions test/e2e/ytsaurus_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,15 @@ func checkClusterBaseViability(ytClient yt.Client) {
}
return len(notGoodBundles) == 0
}, reactionTimeout, pollInterval).Should(BeTrue())

By("Check that lvc == 0")
Eventually(func() bool {
lvcCount, err := components.GetLVCCount(ctx, ytClient)
if err != nil {
return false
}
return lvcCount == 0
}, upgradeTimeout, pollInterval).Should(BeTrue())
}

func checkClusterViability(ytClient yt.Client) {
Expand Down
Loading