-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensuring the integrity of full snapshot before uploading it to the ob…
…ject store. (#779) * Verify the integrity of full snapshot before uploading it to the object store. * Fix compact sub-command while checking integrity of full-snapshot Fix unit tests. * Address review comments. * Address review comments 2. * Address review comments 3. * Address review comments 4. * Add few logs to debug. Rename few variables. * Address review comments. * Refactoring the code. * Reverted one change. * Add unit tests. * use io.CopyBuffer instead of io.copy to improve performance * Fix small things. * Added 1 more unit tests.
- Loading branch information
1 parent
a5d5f56
commit 4703c60
Showing
9 changed files
with
386 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package etcdutil_test | ||
|
||
import ( | ||
"context" | ||
"os" | ||
"testing" | ||
|
||
"github.com/gardener/etcd-backup-restore/test/utils" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
"github.com/sirupsen/logrus" | ||
"go.etcd.io/etcd/embed" | ||
) | ||
|
||
const ( | ||
outputDir = "../../test/output" | ||
etcdDir = outputDir + "/default.etcd" | ||
podName = "etcd-test-0" | ||
) | ||
|
||
var ( | ||
logger = logrus.New().WithField("suite", "etcdutil") | ||
err error | ||
testCtx = context.Background() | ||
etcd *embed.Etcd | ||
) | ||
|
||
func TestEtcdUtil(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "EtcdUtil") | ||
} | ||
|
||
var _ = SynchronizedBeforeSuite(func() []byte { | ||
err = os.RemoveAll(outputDir) | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
|
||
etcd, err = utils.StartEmbeddedEtcd(testCtx, etcdDir, logger, podName, "") | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
var data []byte | ||
etcd.Server.Stop() | ||
etcd.Close() | ||
return data | ||
}, func(data []byte) {}) | ||
|
||
var _ = SynchronizedAfterSuite(func() {}, func() { | ||
err = os.RemoveAll(outputDir) | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
}) |
Oops, something went wrong.