Expose sequence placement controls in the public API
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package configkit
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/ConfigKit/internal/engine"
|
||||
)
|
||||
|
||||
func TestOverlayPublicValues(t *testing.T) {
|
||||
if LayerOverlay != "overlay" {
|
||||
@@ -23,14 +27,17 @@ func TestOverlayPublicValues(t *testing.T) {
|
||||
|
||||
func TestSourceInfoDestinationConversionsAndCopies(t *testing.T) {
|
||||
destination := Keys("collections", "a/b", "0")
|
||||
public := SourceInfo{ID: "source-1", Destination: destination}
|
||||
public := SourceInfo{
|
||||
ID: "source-1", Destination: destination,
|
||||
PlacementMode: PlacementModeSequenceItem, DestinationUnresolved: true,
|
||||
}
|
||||
internal := toEngineSourceInfo(public)
|
||||
if internal.Destination.String() != destination.String() {
|
||||
t.Fatalf("engine destination = %q, want %q", internal.Destination.String(), destination.String())
|
||||
if internal.Destination.String() != destination.String() || engine.SourceInfoPlacementModeForFacade(internal) != uint8(PlacementModeSequenceItem) || !engine.SourceInfoDestinationUnresolvedForFacade(internal) {
|
||||
t.Fatalf("engine source evidence = %#v", internal)
|
||||
}
|
||||
converted := fromEngineSourceInfo(internal)
|
||||
if converted.Destination.String() != destination.String() {
|
||||
t.Fatalf("public destination = %q, want %q", converted.Destination.String(), destination.String())
|
||||
if converted.Destination.String() != destination.String() || converted.PlacementMode != PlacementModeSequenceItem || !converted.DestinationUnresolved {
|
||||
t.Fatalf("public source evidence = %#v", converted)
|
||||
}
|
||||
copy := cloneSourceInfo(converted)
|
||||
copy.Destination = Path{}
|
||||
|
||||
Reference in New Issue
Block a user