From c9656a2baffd73cd537dacd7a2b4b349df2e8624 Mon Sep 17 00:00:00 2001 From: jgough Date: Wed, 5 Feb 2025 10:40:05 +0000 Subject: [PATCH 1/3] Promote find mmr entries and find trie entries to non IKWID commands Also add prod based verification tests to ensure they work. RE: AB#10376 --- app.go | 5 +- findmmrentries.go | 6 +- tests/findmmrentries/findmmrentries_test.go | 226 ++++++++++++++++++ tests/findmmrentries/suite_test.go | 18 ++ tests/findtrieentries/findtrieentries_test.go | 213 +++++++++++++++++ tests/findtrieentries/suite_test.go | 18 ++ tests/katdata/eventsingles.go | 66 +++++ 7 files changed, 547 insertions(+), 5 deletions(-) create mode 100644 tests/findmmrentries/findmmrentries_test.go create mode 100644 tests/findmmrentries/suite_test.go create mode 100644 tests/findtrieentries/findtrieentries_test.go create mode 100644 tests/findtrieentries/suite_test.go diff --git a/app.go b/app.go index 3fe938f..b82f707 100644 --- a/app.go +++ b/app.go @@ -58,14 +58,15 @@ func AddCommands(app *cli.App, ikwid bool) *cli.App { app.Commands = append(app.Commands, NewReplicateLogsCmd()) app.Commands = append(app.Commands, NewReceiptCmd()) + app.Commands = append(app.Commands, NewFindTrieEntriesCmd()) + app.Commands = append(app.Commands, NewFindMMREntriesCmd()) + if ikwid { app.Commands = append(app.Commands, NewMassifsCmd()) app.Commands = append(app.Commands, NewLogTailCmd()) app.Commands = append(app.Commands, NewEventDiagCmd()) app.Commands = append(app.Commands, NewDiagCmd()) app.Commands = append(app.Commands, NewNodeScanCmd()) - app.Commands = append(app.Commands, NewFindTrieEntriesCmd()) - app.Commands = append(app.Commands, NewFindMMREntriesCmd()) } return app } diff --git a/findmmrentries.go b/findmmrentries.go index 9773048..a724d58 100644 --- a/findmmrentries.go +++ b/findmmrentries.go @@ -79,7 +79,7 @@ func findMMREntries( // NOTE: the leaf index and trie index are equivilent. mmrLeafEntries := massifContext.MassifLeafCount() - log.Debugf("checking %v trie entries in massif %v for matches", mmrLeafEntries, massifIndex) + log.Debugf("checking %v mmr entries in massif %v for matches", mmrLeafEntries, massifIndex) // check each mmr leaf entry for matching mmr entry for range mmrLeafEntries { @@ -196,12 +196,12 @@ func NewFindMMREntriesCmd() *cli.Command { }, &cli.Int64Flag{ Name: massifRangeStartFlagName, - Usage: "if set, start the search for matching trie entries at the massif at this given massif index. if omitted will start search at massif 0.", + Usage: "if set, start the search for matching mmr entries at the massif at this given massif index. if omitted will start search at massif 0.", Value: 0, }, &cli.Int64Flag{ Name: massifRangeEndFlagName, - Usage: "if set, end the search for matching trie entries at the massif at this given massif index. if omitted will end search at the last massif.", + Usage: "if set, end the search for matching mmr entries at the massif at this given massif index. if omitted will end search at the last massif.", Value: -1, }, }, diff --git a/tests/findmmrentries/findmmrentries_test.go b/tests/findmmrentries/findmmrentries_test.go new file mode 100644 index 0000000..1ed69f5 --- /dev/null +++ b/tests/findmmrentries/findmmrentries_test.go @@ -0,0 +1,226 @@ +package findmmrentries + +import ( + "io" + "os" + "strings" + + "github.com/datatrails/veracity" + "github.com/datatrails/veracity/tests/katdata" +) + +const ( + prodPublicTenant = "tenant/6ea5cd00-c711-3649-6914-7b125928bbb4" + prodEventsv1Tenant = "tenant/97e90a09-8c56-40df-a4de-42fde462ef6f" +) + +// TestAssetsV2EventStdIn tests we can find +// the correct PROD public assetsv2 event mmr entry match +func (s *FindMMREntriesSuite) TestAssetsV2EventStdIn() { + assert := s.Assert() + require := s.Require() + + app := veracity.NewApp("version", true) + veracity.AddCommands(app, true) + + // note: the suite does a before & after pipe for Stdin + s.StdinWriteAndClose(katdata.KnownGoodPublicAssetsV1EventLaterMassif) + + // redirect std out to a known pipe so we can capture it + rescueStdout := os.Stdout + defer func() { os.Stdout = rescueStdout }() // ensure we redirect std out back after + + reader, writer, _ := os.Pipe() + os.Stdout = writer + + err := app.Run([]string{ + "veracity", + "find-mmr-entries", + "--log-tenant", prodPublicTenant, + }) + assert.NoErrorf(err, "the event is a known good event from the public production tenant, yet we have errored trying to find the mmr entries") + + writer.Close() + actualBytes, err := io.ReadAll(reader) + require.NoError(err) + + // convert the stdout to a string and strip the newlines + actual := strings.ReplaceAll(string(actualBytes), "\n", "") + + assert.Equal("matches: [27899]", actual) +} + +// TestAssetsV2EventAsLeafIndexStdIn tests we can find +// the correct PROD public assetsv2 event mmr entry match as +// a leaf index. +func (s *FindMMREntriesSuite) TestAssetsV2EventAsLeafIndexStdIn() { + assert := s.Assert() + require := s.Require() + + app := veracity.NewApp("version", true) + veracity.AddCommands(app, true) + + // note: the suite does a before & after pipe for Stdin + s.StdinWriteAndClose(katdata.KnownGoodPublicAssetsV1EventLaterMassif) + + // redirect std out to a known pipe so we can capture it + rescueStdout := os.Stdout + defer func() { os.Stdout = rescueStdout }() // ensure we redirect std out back after + + reader, writer, _ := os.Pipe() + os.Stdout = writer + + err := app.Run([]string{ + "veracity", + "find-mmr-entries", + "--log-tenant", prodPublicTenant, + "--massif-start", "1", + "--massif-end", "1", // the event is in massif 1 + "--as-leafindexes", "true", + }) + assert.NoErrorf(err, "the event is a known good event from the public production tenant, yet we have errored trying to find the mmr entries") + + writer.Close() + actualBytes, err := io.ReadAll(reader) + require.NoError(err) + + // convert the stdout to a string and strip the newlines + actual := strings.ReplaceAll(string(actualBytes), "\n", "") + + assert.Equal("matches: [13952]", actual) +} + +// TestAssetsV2EventWrongMassifStdIn tests we CANNOT find +// the correct PROD public assetsv2 event mmr entry match +// if we set the range of massifs to not include the massif the event is in. +func (s *FindMMREntriesSuite) TestAssetsV2EventWrongMassifStdIn() { + assert := s.Assert() + require := s.Require() + + app := veracity.NewApp("version", true) + veracity.AddCommands(app, true) + + // note: the suite does a before & after pipe for Stdin + s.StdinWriteAndClose(katdata.KnownGoodPublicAssetsV1EventLaterMassif) + + // redirect std out to a known pipe so we can capture it + rescueStdout := os.Stdout + defer func() { os.Stdout = rescueStdout }() // ensure we redirect std out back after + + reader, writer, _ := os.Pipe() + os.Stdout = writer + + err := app.Run([]string{ + "veracity", + "find-mmr-entries", + "--log-tenant", prodPublicTenant, + "--massif-start", "0", + "--massif-end", "0", // the actual event is in massif 1 + }) + assert.NoErrorf(err, "the event is a known good event from the public production tenant, yet we have errored trying to find the mmr entries") + + writer.Close() + actualBytes, err := io.ReadAll(reader) + require.NoError(err) + + // convert the stdout to a string and strip the newlines + actual := strings.ReplaceAll(string(actualBytes), "\n", "") + + assert.Equal("matches: []", actual) +} + +// TestAssetsV2EventCorrectMassifStdIn tests we CAN find +// the correct PROD public assetsv2 event mmr entry match +// if we set the range of massifs to include ONLY the massif the event is in. +func (s *FindMMREntriesSuite) TestAssetsV2EventCorrectMassifStdIn() { + assert := s.Assert() + require := s.Require() + + app := veracity.NewApp("version", true) + veracity.AddCommands(app, true) + + // note: the suite does a before & after pipe for Stdin + s.StdinWriteAndClose(katdata.KnownGoodPublicAssetsV1EventLaterMassif) + + // redirect std out to a known pipe so we can capture it + rescueStdout := os.Stdout + defer func() { os.Stdout = rescueStdout }() // ensure we redirect std out back after + + rescueStderr := os.Stderr + defer func() { os.Stderr = rescueStderr }() // ensure we redirect std err back after + + readerStdOut, writerStdOut, _ := os.Pipe() + os.Stdout = writerStdOut + + readerStdErr, writerStdErr, _ := os.Pipe() + os.Stderr = writerStdErr + + err := app.Run([]string{ + "veracity", + "--loglevel", "DEBUG", + "find-mmr-entries", + "--log-tenant", prodPublicTenant, + "--massif-start", "1", + "--massif-end", "1", // the actual event is in massif 1 + }) + assert.NoErrorf(err, "the event is a known good event from the public production tenant, yet we have errored trying to find the mmr entries") + + writerStdOut.Close() + actualStdOutBytes, err := io.ReadAll(readerStdOut) + require.NoError(err) + + writerStdErr.Close() + actualStdErrBytes, err := io.ReadAll(readerStdErr) + require.NoError(err) + + // convert the stdout to string and string new lines and convert stderr to string + actualStdOut := strings.ReplaceAll(string(actualStdOutBytes), "\n", "") + actualStdErr := string(actualStdErrBytes) + + // assert we are checking the correct massif + assert.Contains(actualStdErr, "mmr entries in massif 1 for matches") + + // assert we are not checking the neighbouring massifs + assert.NotContains(actualStdErr, "mmr entries in massif 0 for matches") + assert.NotContains(actualStdErr, "mmr entries in massif 2 for matches") + + assert.Equal("matches: [27899]", actualStdOut) +} + +// TestEventsV1EventRepeatedAppDataStdIn tests we can find +// the correct PROD eventsv1 event mmr entry matches for app data used +// for 2 events on the same log tenant. +func (s *FindMMREntriesSuite) TestEventsV1EventRepeatedAppDataStdIn() { + assert := s.Assert() + require := s.Require() + + app := veracity.NewApp("version", true) + veracity.AddCommands(app, true) + + // note: the suite does a before & after pipe for Stdin + s.StdinWriteAndClose(katdata.KnownGoodEventsv1RepeatedAppData) + + // redirect std out to a known pipe so we can capture it + rescueStdout := os.Stdout + defer func() { os.Stdout = rescueStdout }() // ensure we redirect std out back after + + reader, writer, _ := os.Pipe() + os.Stdout = writer + + err := app.Run([]string{ + "veracity", + "find-mmr-entries", + "--log-tenant", prodEventsv1Tenant, + }) + assert.NoErrorf(err, "the event is a known good event from the production tenant we are using for test eventsv1 events, yet we have errored trying to find the mmr entries") + + writer.Close() + actualBytes, err := io.ReadAll(reader) + require.NoError(err) + + // convert the stdout to a string and strip the newlines + actual := strings.ReplaceAll(string(actualBytes), "\n", "") + + // check we get back matches mmr indexes 26 and 31 + assert.Equal("matches: [26 31]", actual) +} diff --git a/tests/findmmrentries/suite_test.go b/tests/findmmrentries/suite_test.go new file mode 100644 index 0000000..1b98e80 --- /dev/null +++ b/tests/findmmrentries/suite_test.go @@ -0,0 +1,18 @@ +package findmmrentries + +import ( + "testing" + + "github.com/datatrails/veracity/tests" + "github.com/stretchr/testify/suite" +) + +// FindMMREntriesSuite deals with tests around finding mmr entries +type FindMMREntriesSuite struct { + tests.IntegrationTestSuite +} + +func TestFindMMREntriesSuite(t *testing.T) { + + suite.Run(t, new(FindMMREntriesSuite)) +} diff --git a/tests/findtrieentries/findtrieentries_test.go b/tests/findtrieentries/findtrieentries_test.go new file mode 100644 index 0000000..3e4d1a7 --- /dev/null +++ b/tests/findtrieentries/findtrieentries_test.go @@ -0,0 +1,213 @@ +package findtrieentries + +import ( + "io" + "os" + "strings" + + "github.com/datatrails/veracity" +) + +const ( + prodPublicTenant = "tenant/6ea5cd00-c711-3649-6914-7b125928bbb4" + prodEventsv1Tenant = "tenant/97e90a09-8c56-40df-a4de-42fde462ef6f" +) + +// TestAssetsV2EventStdIn tests we can find +// the correct PROD public assetsv2 event trie entry match +func (s *FindTrieEntriesSuite) TestAssetsV2EventStdIn() { + assert := s.Assert() + require := s.Require() + + app := veracity.NewApp("version", true) + veracity.AddCommands(app, true) + + // redirect std out to a known pipe so we can capture it + rescueStdout := os.Stdout + defer func() { os.Stdout = rescueStdout }() // ensure we redirect std out back after + + reader, writer, _ := os.Pipe() + os.Stdout = writer + + err := app.Run([]string{ + "veracity", + "find-trie-entries", + "--log-tenant", prodPublicTenant, + "--app-id", "assets/20e0864f-423c-4a09-8819-baac2ed326e4/events/effa4ea1-e96d-4272-8c06-c09453c75621", // identity of the event with the public prefix striped + }) + assert.NoErrorf(err, "the event is a known good event from the public production tenant, yet we have errored trying to find the trie entries") + + writer.Close() + actualBytes, err := io.ReadAll(reader) + require.NoError(err) + + // convert the stdout to a string and strip the newlines + actual := strings.ReplaceAll(string(actualBytes), "\n", "") + + assert.Equal("matches: [27899]", actual) +} + +// TestAssetsV2EventAsLeafIndexStdIn tests we can find +// the correct PROD public assetsv2 event trie entry match as +// a leaf index. +func (s *FindTrieEntriesSuite) TestAssetsV2EventAsLeafIndexStdIn() { + assert := s.Assert() + require := s.Require() + + app := veracity.NewApp("version", true) + veracity.AddCommands(app, true) + + // redirect std out to a known pipe so we can capture it + rescueStdout := os.Stdout + defer func() { os.Stdout = rescueStdout }() // ensure we redirect std out back after + + reader, writer, _ := os.Pipe() + os.Stdout = writer + + err := app.Run([]string{ + "veracity", + "find-trie-entries", + "--log-tenant", prodPublicTenant, + "--app-id", "assets/20e0864f-423c-4a09-8819-baac2ed326e4/events/effa4ea1-e96d-4272-8c06-c09453c75621", // identity of the event with the public prefix striped + "--massif-start", "1", + "--massif-end", "1", // event is in massif 1 + "--as-leafindexes", + }) + assert.NoErrorf(err, "the event is a known good event from the public production tenant, yet we have errored trying to find the trie entries") + + writer.Close() + actualBytes, err := io.ReadAll(reader) + require.NoError(err) + + // convert the stdout to a string and strip the newlines + actual := strings.ReplaceAll(string(actualBytes), "\n", "") + + assert.Equal("matches: [13952]", actual) +} + +// TestAssetsV2EventWrongMassifStdIn tests we CANNOT find +// the correct PROD public assetsv2 event trie entry match +// if we set the range of massifs to not include the massif the event is in. +func (s *FindTrieEntriesSuite) TestAssetsV2EventWrongMassifStdIn() { + assert := s.Assert() + require := s.Require() + + app := veracity.NewApp("version", true) + veracity.AddCommands(app, true) + + // redirect std out to a known pipe so we can capture it + rescueStdout := os.Stdout + defer func() { os.Stdout = rescueStdout }() // ensure we redirect std out back after + + reader, writer, _ := os.Pipe() + os.Stdout = writer + + err := app.Run([]string{ + "veracity", + "find-trie-entries", + "--log-tenant", prodPublicTenant, + "--app-id", "assets/20e0864f-423c-4a09-8819-baac2ed326e4/events/effa4ea1-e96d-4272-8c06-c09453c75621", // identity of the event with the public prefix striped + "--massif-start", "0", + "--massif-end", "0", // event is in massif 1 + }) + assert.NoErrorf(err, "the event is a known good event from the public production tenant, yet we have errored trying to find the trie entries") + + writer.Close() + actualBytes, err := io.ReadAll(reader) + require.NoError(err) + + // convert the stdout to a string and strip the newlines + actual := strings.ReplaceAll(string(actualBytes), "\n", "") + + assert.Equal("matches: []", actual) +} + +// TestAssetsV2EventCorrectMassifStdIn tests we CAN find +// the correct PROD public assetsv2 event trie entry match +// if we set the range of massifs to include ONLY the massif the event is in. +func (s *FindTrieEntriesSuite) TestAssetsV2EventCorrectMassifStdIn() { + assert := s.Assert() + require := s.Require() + + app := veracity.NewApp("version", true) + veracity.AddCommands(app, true) + + // redirect std out to a known pipe so we can capture it + rescueStdout := os.Stdout + defer func() { os.Stdout = rescueStdout }() // ensure we redirect std out back after + + rescueStderr := os.Stderr + defer func() { os.Stderr = rescueStderr }() // ensure we redirect std err back after + + readerStdOut, writerStdOut, _ := os.Pipe() + os.Stdout = writerStdOut + + readerStdErr, writerStdErr, _ := os.Pipe() + os.Stderr = writerStdErr + + err := app.Run([]string{ + "veracity", + "--loglevel", "DEBUG", + "find-trie-entries", + "--log-tenant", prodPublicTenant, + "--app-id", "assets/20e0864f-423c-4a09-8819-baac2ed326e4/events/effa4ea1-e96d-4272-8c06-c09453c75621", // identity of the event with the public prefix striped + "--massif-start", "1", + "--massif-end", "1", // event is in massif 1 + }) + assert.NoErrorf(err, "the event is a known good event from the public production tenant, yet we have errored trying to find the trie entries") + + writerStdOut.Close() + actualStdOutBytes, err := io.ReadAll(readerStdOut) + require.NoError(err) + + writerStdErr.Close() + actualStdErrBytes, err := io.ReadAll(readerStdErr) + require.NoError(err) + + // convert the stdout to string and string new lines and convert stderr to string + actualStdOut := strings.ReplaceAll(string(actualStdOutBytes), "\n", "") + actualStdErr := string(actualStdErrBytes) + + // assert we are checking the correct massif + assert.Contains(actualStdErr, "trie entries in massif 1 for matches") + + // assert we are not checking the neighbouring massifs + assert.NotContains(actualStdErr, "trie entries in massif 0 for matches") + assert.NotContains(actualStdErr, "trie entries in massif 2 for matches") + + assert.Equal("matches: [27899]", actualStdOut) +} + +// TestEventsV1EventStdIn tests we can find +// the correct PROD eventsv1 event trie entry match. +func (s *FindTrieEntriesSuite) TestEventsV1EventStdIn() { + assert := s.Assert() + require := s.Require() + + app := veracity.NewApp("version", true) + veracity.AddCommands(app, true) + + // redirect std out to a known pipe so we can capture it + rescueStdout := os.Stdout + defer func() { os.Stdout = rescueStdout }() // ensure we redirect std out back after + + reader, writer, _ := os.Pipe() + os.Stdout = writer + + err := app.Run([]string{ + "veracity", + "find-trie-entries", + "--log-tenant", prodEventsv1Tenant, + "--app-id", "events/0194b168-bac0-75e6-bbc4-a47cc45bdbf5", // identity of the event + }) + assert.NoErrorf(err, "the event is a known good event from the production tenant we are using for test eventsv1 events, yet we have errored trying to find the trie entries") + + writer.Close() + actualBytes, err := io.ReadAll(reader) + require.NoError(err) + + // convert the stdout to a string and strip the newlines + actual := strings.ReplaceAll(string(actualBytes), "\n", "") + + assert.Equal("matches: [4]", actual) +} diff --git a/tests/findtrieentries/suite_test.go b/tests/findtrieentries/suite_test.go new file mode 100644 index 0000000..0779f73 --- /dev/null +++ b/tests/findtrieentries/suite_test.go @@ -0,0 +1,18 @@ +package findtrieentries + +import ( + "testing" + + "github.com/datatrails/veracity/tests" + "github.com/stretchr/testify/suite" +) + +// FindTrieEntriesSuite deals with tests around finding trie entries +type FindTrieEntriesSuite struct { + tests.IntegrationTestSuite +} + +func TestFindTrieEntriesSuite(t *testing.T) { + + suite.Run(t, new(FindTrieEntriesSuite)) +} diff --git a/tests/katdata/eventsingles.go b/tests/katdata/eventsingles.go index bd43e80..d11d191 100644 --- a/tests/katdata/eventsingles.go +++ b/tests/katdata/eventsingles.go @@ -69,6 +69,56 @@ var ( } }`) + KnownGoodPublicAssetsV1EventLaterMassif = []byte(`{ + "identity": "publicassets/20e0864f-423c-4a09-8819-baac2ed326e4/events/effa4ea1-e96d-4272-8c06-c09453c75621", + "asset_identity": "publicassets/20e0864f-423c-4a09-8819-baac2ed326e4", + "event_attributes": { + "5": "put in the over until golden brown", + "1": "pour flour and milk into bowl", + "2": "mix together until gloopy", + "3": "slowly add in the sugar while still mixing", + "4": "finally add in the eggs" + }, + "asset_attributes": {}, + "operation": "Record", + "behaviour": "RecordEvidence", + "timestamp_declared": "2025-02-05T09:21:55Z", + "timestamp_accepted": "2025-02-05T09:21:55Z", + "timestamp_committed": "2025-02-05T09:21:55.785410491Z", + "principal_declared": { + "issuer": "", + "subject": "", + "display_name": "", + "email": "" + }, + "principal_accepted": { + "issuer": "", + "subject": "", + "display_name": "", + "email": "" + }, + "confirmation_status": "CONFIRMED", + "transaction_id": "", + "block_number": 0, + "transaction_index": 0, + "from": "0x23F97B5b34433f4fF55898fFF4b0682Deb25Cafe", + "tenant_identity": "tenant/97e90a09-8c56-40df-a4de-42fde462ef6f", + "merklelog_entry": { + "commit": { + "index": "27899", + "idtimestamp": "0194d56a8a4e058c00" + }, + "confirm": { + "mmr_size": "27900", + "root": "eyQHuUeNhSupHV7HCGqcIBK/tgcuw/X8XfrdlGvGNdOq1bKe35hi3Sja6vBYaXy10p3vvTGkyMtu4Wr8zeZ6BNWWPqeNUUt3vZVAH784nsntSjgKVC2JiiiQJZustlQ0HMa1QJqA6AjzKnVkn5P9u9ZPUPdU7Yl6sA2Ts9LyXLyqTBzs+mD7xCycyFiPdcsM4b1K8Xzply9KNS1MT4KILGOeOOI5mu4BWjR8G9CRro7KYJbQkHWCLCwk4CPWGxgF", + "timestamp": "1738747318412", + "idtimestamp": "", + "signed_tree_head": "" + }, + "unequivocal": null + } +}`) + KnownGoodEventsV1Event = []byte(`{ "identity": "events/0194b168-bac0-75e6-bbc4-a47cc45bdbf5", "attributes": { @@ -91,6 +141,22 @@ var ( } }`) + // KnownGoodEventsv1RepeatedAppData is a known good events v1 app data (attributes + trails) + // on prod, that was used to create exactly 2 events within the same log tenant. + KnownGoodEventsv1RepeatedAppData = []byte(`{ + "attributes": { + "4": "finally add in the eggs", + "5": "put in the oven until golden brown", + "6": "leave to cool", + "1": "pour flour and milk into bowl", + "2": "mix together until gloopy", + "3": "slowly add in the sugar while still mixing" + }, + "trails": [ + "cake" + ] +}`) + // The 'tamper' is the 'a' from a single arc_ event attribute has been clipped. KnownTamperedPublicEvent = []byte(`{ "identity": "publicassets/87dd2e5a-42b4-49a5-8693-97f40a5af7f8/events/a022f458-8e55-4d63-a200-4172a42fc2aa", From e27a0cadaf9b8279d558d2759309f519c0fd2ebc Mon Sep 17 00:00:00 2001 From: jgough Date: Fri, 14 Feb 2025 08:41:54 +0000 Subject: [PATCH 2/3] fixup --- tests/findmmrentries/findmmrentries_test.go | 8 ++++---- tests/katdata/eventsingles.go | 2 +- tests/systemtest/test.sh | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/findmmrentries/findmmrentries_test.go b/tests/findmmrentries/findmmrentries_test.go index 1ed69f5..6d07902 100644 --- a/tests/findmmrentries/findmmrentries_test.go +++ b/tests/findmmrentries/findmmrentries_test.go @@ -24,7 +24,7 @@ func (s *FindMMREntriesSuite) TestAssetsV2EventStdIn() { veracity.AddCommands(app, true) // note: the suite does a before & after pipe for Stdin - s.StdinWriteAndClose(katdata.KnownGoodPublicAssetsV1EventLaterMassif) + s.StdinWriteAndClose(katdata.KnownGoodPublicAssetsV2EventLaterMassif) // redirect std out to a known pipe so we can capture it rescueStdout := os.Stdout @@ -61,7 +61,7 @@ func (s *FindMMREntriesSuite) TestAssetsV2EventAsLeafIndexStdIn() { veracity.AddCommands(app, true) // note: the suite does a before & after pipe for Stdin - s.StdinWriteAndClose(katdata.KnownGoodPublicAssetsV1EventLaterMassif) + s.StdinWriteAndClose(katdata.KnownGoodPublicAssetsV2EventLaterMassif) // redirect std out to a known pipe so we can capture it rescueStdout := os.Stdout @@ -101,7 +101,7 @@ func (s *FindMMREntriesSuite) TestAssetsV2EventWrongMassifStdIn() { veracity.AddCommands(app, true) // note: the suite does a before & after pipe for Stdin - s.StdinWriteAndClose(katdata.KnownGoodPublicAssetsV1EventLaterMassif) + s.StdinWriteAndClose(katdata.KnownGoodPublicAssetsV2EventLaterMassif) // redirect std out to a known pipe so we can capture it rescueStdout := os.Stdout @@ -140,7 +140,7 @@ func (s *FindMMREntriesSuite) TestAssetsV2EventCorrectMassifStdIn() { veracity.AddCommands(app, true) // note: the suite does a before & after pipe for Stdin - s.StdinWriteAndClose(katdata.KnownGoodPublicAssetsV1EventLaterMassif) + s.StdinWriteAndClose(katdata.KnownGoodPublicAssetsV2EventLaterMassif) // redirect std out to a known pipe so we can capture it rescueStdout := os.Stdout diff --git a/tests/katdata/eventsingles.go b/tests/katdata/eventsingles.go index d11d191..478d074 100644 --- a/tests/katdata/eventsingles.go +++ b/tests/katdata/eventsingles.go @@ -69,7 +69,7 @@ var ( } }`) - KnownGoodPublicAssetsV1EventLaterMassif = []byte(`{ + KnownGoodPublicAssetsV2EventLaterMassif = []byte(`{ "identity": "publicassets/20e0864f-423c-4a09-8819-baac2ed326e4/events/effa4ea1-e96d-4272-8c06-c09453c75621", "asset_identity": "publicassets/20e0864f-423c-4a09-8819-baac2ed326e4", "event_attributes": { diff --git a/tests/systemtest/test.sh b/tests/systemtest/test.sh index aefd64a..b4580c0 100755 --- a/tests/systemtest/test.sh +++ b/tests/systemtest/test.sh @@ -131,26 +131,26 @@ testVerifySingleEventWithLocalMassifCopy() { testFindTrieEntrySingleEvent() { # Verify the trie key for the known event is on the log at the correct position. PUBLIC_EVENT_PERMISSIONED_ID=${PUBLIC_EVENT_ID#"public"} - output=$(VERACITY_IKWID=true $VERACITY_INSTALL find-trie-entries --log-tenant $PROD_PUBLIC_TENANT_ID --app-id $PUBLIC_EVENT_PERMISSIONED_ID) + output=$($VERACITY_INSTALL find-trie-entries --log-tenant $PROD_PUBLIC_TENANT_ID --app-id $PUBLIC_EVENT_PERMISSIONED_ID) assertEquals "verifying finding the trie entry of a known public prod event from the datatrails log should match mmr index 663" "matches: [663]" "$output" } testFindTrieEntrySingleEventWithLocalMassifCopy() { # Verify the trie key for the known event is on the log at the correct position for a local log. PUBLIC_EVENT_PERMISSIONED_ID=${PUBLIC_EVENT_ID#"public"} - output=$(VERACITY_IKWID=true $VERACITY_INSTALL --data-local $PROD_LOCAL_BLOB_FILE find-trie-entries --log-tenant $PROD_PUBLIC_TENANT_ID --app-id $PUBLIC_EVENT_PERMISSIONED_ID) + output=$(VERACITY_INSTALL --data-local $PROD_LOCAL_BLOB_FILE find-trie-entries --log-tenant $PROD_PUBLIC_TENANT_ID --app-id $PUBLIC_EVENT_PERMISSIONED_ID) assertEquals "verifying finding the trie entry of a known public prod event from a local log should match mmr index 663" "matches: [663]" "$output" } testFindMMREntrySingleEvent() { # Verify the mmr entry for the known event is on the log at the correct position. - output=$(curl -sL $DATATRAILS_URL/archivist/v2/$PUBLIC_EVENT_ID | VERACITY_IKWID=true $VERACITY_INSTALL find-mmr-entries --log-tenant $PROD_PUBLIC_TENANT_ID) + output=$(curl -sL $DATATRAILS_URL/archivist/v2/$PUBLIC_EVENT_ID | $VERACITY_INSTALL find-mmr-entries --log-tenant $PROD_PUBLIC_TENANT_ID) assertEquals "verifying finding the mmr entry of a known public prod event from the datatrails log should match mmr index 663" "matches: [663]" "$output" } testFindMMREntrySingleEventWithLocalMassifCopy() { # Verify the mmr entry for the known event is on the log at the correct position. - output=$(curl -sL $DATATRAILS_URL/archivist/v2/$PUBLIC_EVENT_ID | VERACITY_IKWID=true $VERACITY_INSTALL --data-local $PROD_LOCAL_BLOB_FILE find-mmr-entries --log-tenant $PROD_PUBLIC_TENANT_ID) + output=$(curl -sL $DATATRAILS_URL/archivist/v2/$PUBLIC_EVENT_ID | $VERACITY_INSTALL --data-local $PROD_LOCAL_BLOB_FILE find-mmr-entries --log-tenant $PROD_PUBLIC_TENANT_ID) assertEquals "verifying finding the mmr entry of a known public prod event from a local log should match mmr index 663" "matches: [663]" "$output" } From b99eca7c78f7f48d51e6211adb73f26259594e0c Mon Sep 17 00:00:00 2001 From: jgough Date: Fri, 14 Feb 2025 08:46:22 +0000 Subject: [PATCH 3/3] fixup --- tests/systemtest/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/systemtest/test.sh b/tests/systemtest/test.sh index b4580c0..5241b70 100755 --- a/tests/systemtest/test.sh +++ b/tests/systemtest/test.sh @@ -138,7 +138,7 @@ testFindTrieEntrySingleEvent() { testFindTrieEntrySingleEventWithLocalMassifCopy() { # Verify the trie key for the known event is on the log at the correct position for a local log. PUBLIC_EVENT_PERMISSIONED_ID=${PUBLIC_EVENT_ID#"public"} - output=$(VERACITY_INSTALL --data-local $PROD_LOCAL_BLOB_FILE find-trie-entries --log-tenant $PROD_PUBLIC_TENANT_ID --app-id $PUBLIC_EVENT_PERMISSIONED_ID) + output=$($VERACITY_INSTALL --data-local $PROD_LOCAL_BLOB_FILE find-trie-entries --log-tenant $PROD_PUBLIC_TENANT_ID --app-id $PUBLIC_EVENT_PERMISSIONED_ID) assertEquals "verifying finding the trie entry of a known public prod event from a local log should match mmr index 663" "matches: [663]" "$output" }