Skip to content

Bugfix/134 wait for deletion of configmap#142

Open
notmyown wants to merge 14 commits into
developfrom
bugfix/134-wait-for-deletion-of-configmap
Open

Bugfix/134 wait for deletion of configmap#142
notmyown wants to merge 14 commits into
developfrom
bugfix/134-wait-for-deletion-of-configmap

Conversation

@notmyown

@notmyown notmyown commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@notmyown notmyown linked an issue Jul 7, 2026 that may be closed by this pull request
@meiserloh

Copy link
Copy Markdown
Contributor

Is missing in BackupSchedules, doesn't it?

@meiserloh

Copy link
Copy Markdown
Contributor

Sonarqube is unhappy with test coverage :(

Comment thread migration/config/dogu.go Outdated
}

err = migration.WaitForDeletion(func() error {
_, terror := repo.Get(ctx, doguName)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is terror a thing or a typo? shouldn't we write it t_error or something (i am not even sure what the t is meaning - probably timeout)?

Comment thread migration/config/dogu_test.go Outdated
Comment on lines 164 to 171
mockRepo.EXPECT().Get(testCtx, doguName).Return(regConfig.DoguConfig{}, apierrors.NewNotFound(
schema.GroupResource{
Group: "",
Resource: "configmaps",
},
doguName.String(),
))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is adding much bloat to every positive test. Should we introduce a file-wide variable? Or at least remove the Group and Resource, since they are not checked anyways?

Comment on lines +16 to +22
oldWaitFunc := migration.WaitForDeletion
migration.WaitForDeletion = func(check func() error) error {
return nil
}
defer func() {
migration.WaitForDeletion = oldWaitFunc
}()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So why no global-config tests?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to keep the unittests as they were

  • added another test for specificly testing wait function on global-config

Comment thread migration/deleteChecker.go
Comment thread migration/config/dogu.go Outdated
Comment on lines 84 to 86

@meiserloh meiserloh Jul 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// importDoguConfigWithRepo imports a dogu configuration into a doguConfigRepo by wiping the
// existing config and refilling it. Excluded keys are restored to their original values, or
// skipped if they didn't exist before the import.

Comment thread migration/config/dogu.go Outdated
Comment on lines +90 to +112
}
} else {
return fmt.Errorf("failed to get original dogu config: %w", err)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change the order of operations to remove the second get:

	registryDoguConfig, err := repo.Get(ctx, doguName)
	slog.Debug(fmt.Sprintf("old dogu config %s: %v", doguName, registryDoguConfig))
	if err != nil {
		if !ceserrors.IsNotFoundError(err) && !apierrors.IsNotFound(err) {
			return fmt.Errorf("failed to get original dogu config: %w", err)
		}
		registryDoguConfig, err = repo.Create(ctx, regConfig.CreateDoguConfig(doguName, map[regConfig.Key]regConfig.Value{}))
		if err != nil {
			return fmt.Errorf("failed to create new dogu config: %w", err)
		}
	}
	originalValues := registryDoguConfig

Comment thread migration/config/dogu.go Outdated
if err != nil {
return fmt.Errorf("failed to create new dogu config: %w", err)
}
//whipe out old config

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a little context:

// wipe out old config so we overwrite instead of merging with old values.

or something

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wait for deletion of configmap

2 participants