bufsynctest

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReleaseBranchName        = "__release__"
	OtherProtectedBranchName = "__protected__"
)

Variables

This section is empty.

Functions

func RunTestSuite

func RunTestSuite(t *testing.T, handlerProvider func() TestHandler)

RunTestSuite runs a set of test cases using Syncer with the provided TestHandler. Use this test suite to ensure compliance with Sync behavior.

The following behavior is asserted:

Local validation

  • Prevent duplicate module identities across module dirs on a branch.

Syncing commits

CONDITION                        RESUME FROM (-> means fallback)
new remote branch:
  unprotected:                   any synced commit from any branch -> START of branch
  protected:
    not release branch:          START of branch
    release lineage:
      empty:                     START of branch
      not empty:                 content match(HEAD of Release) -> HEAD of branch
existing remote branch:
  not previously synced:         content match -> HEAD of branch
  previously synced:
    protected:                   protect branch && any synced commit from branch -> error
    unprotected:                 any synced commit from any branch -> content match -> HEAD of branch

Types

type TestHandler

type TestHandler interface {
	bufsync.Handler
	ManuallyPushModule(
		ctx context.Context,
		t *testing.T,
		targetModuleIdentity bufmoduleref.ModuleIdentity,
		branchName string,
		manifest *modulev1alpha1.Blob,
		blobs []*modulev1alpha1.Blob,
	)
}

TestHandler is a bufsync.Handler with a few helpful utilities for tests to set up and assert some state.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL