Complete historical inventory and query services
This commit is contained in:
@@ -55,7 +55,7 @@ func TestMetadataPathIndexesOwnIndependentSegments(t *testing.T) {
|
||||
finalizeMetadataPaths(&metadata, final, nil)
|
||||
pointer := "/service/workers/0"
|
||||
effective := metadata.effectivePaths[pointer]
|
||||
historical := metadata.historicalPaths[pointer]
|
||||
historical := metadata.historyModel.concreteShapes(pointer)
|
||||
if effective.String() != pointer || len(historical) != 1 || historical[0].String() != pointer {
|
||||
t.Fatalf("path indexes = %#v, %#v", effective, historical)
|
||||
}
|
||||
@@ -84,7 +84,7 @@ func TestMetadataPathIndexesRetainDistinctHistoricalShapes(t *testing.T) {
|
||||
if !reflect.DeepEqual(metadata.effectivePaths[pointer], indexPath) {
|
||||
t.Fatal("effective index does not reflect the final sequence")
|
||||
}
|
||||
historical := metadata.historicalPaths[pointer]
|
||||
historical := metadata.historyModel.concreteShapes(pointer)
|
||||
if len(historical) != 2 {
|
||||
t.Fatalf("historical shapes = %#v, want one key and one index", historical)
|
||||
}
|
||||
@@ -99,6 +99,16 @@ func TestMetadataPathIndexesRetainDistinctHistoricalShapes(t *testing.T) {
|
||||
t.Fatalf("historical index lost shape %#v", want)
|
||||
}
|
||||
}
|
||||
paths := metadata.HistoricalPaths()
|
||||
var pointers []string
|
||||
for _, path := range paths {
|
||||
pointers = append(pointers, path.String())
|
||||
}
|
||||
if !reflect.DeepEqual(pointers, []string{"", "/shape", "/shape/0"}) ||
|
||||
len(paths[2].segments) != 2 || paths[2].segments[1].kind != pathSegmentParsed ||
|
||||
metadata.hasHistoricalPath(Keys("shape", "missing")) {
|
||||
t.Fatalf("historical enumeration or membership = %#v", paths)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHistoricalPathsExposeHiddenBaseOwnershipWithoutResolvingBaseSecrets(t *testing.T) {
|
||||
@@ -149,9 +159,11 @@ func TestMetadataQueriesReturnDetachedRecords(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
path := Keys("service", "workers")
|
||||
builder := newHistoryBuilder()
|
||||
builder.observeDocument(parseDocumentForDecode(t, "service: {workers: null}\n"), historyPhaseBaseline)
|
||||
metadata := Metadata{
|
||||
effectivePaths: map[string]Path{path.String(): path},
|
||||
historicalPaths: map[string][]Path{path.String(): {path}},
|
||||
effectivePaths: map[string]Path{path.String(): path},
|
||||
historyModel: builder.freeze(),
|
||||
fields: map[string]FieldInfo{
|
||||
path.String(): {
|
||||
Explicit: true,
|
||||
|
||||
Reference in New Issue
Block a user