this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

more event types in basic test

+89 -22
+2
cmd/relayered/relay/firehose.go
··· 81 81 r.Logger.Info("relay got account event", "did", env.RepoAccount.Did) 82 82 83 83 if !env.RepoAccount.Active && env.RepoAccount.Status == nil { 84 + // TODO: semantics here aren't really clear 85 + r.Logger.Warn("dropping invalid account event", "did", env.RepoAccount.Did, "active", env.RepoAccount.Active, "status", env.RepoAccount.Status) 84 86 accountVerifyWarnings.WithLabelValues(host.Host, "nostat").Inc() 85 87 return nil 86 88 }
+2 -2
cmd/relayered/testing/framework_test.go
··· 66 66 assert.Equal("https://morel.us-east.host.bsky.network", s.Accounts[0].Identity.PDSEndpoint()) 67 67 _, err = s.Accounts[0].Identity.PublicKey() 68 68 assert.NoError(err) 69 - assert.Equal(1, len(s.Messages)) 70 - msg, err := s.Messages[0].Frame.XRPCStreamEvent() 69 + assert.Equal(3, len(s.Messages)) 70 + msg, err := s.Messages[2].Frame.XRPCStreamEvent() 71 71 if err != nil { 72 72 t.Fatal(err) 73 73 }
+52 -20
cmd/relayered/testing/runner.go
··· 119 119 } 120 120 defer c.Shutdown() 121 121 122 - for _, msg := range s.Messages { 122 + for i, msg := range s.Messages { 123 + slog.Info("sending test message", "index", i) 123 124 c.Clear() 124 125 evt, err := msg.Frame.XRPCStreamEvent() 125 126 if err != nil { ··· 135 136 return fmt.Errorf("consumed unexpected events") 136 137 } 137 138 if !EqualEvents(evt, evts[0]) { 139 + //evt.RepoCommit.Blocks = nil 140 + //evts[0].RepoCommit.Blocks = nil 138 141 fmt.Printf("%+v\n", evt.RepoCommit) 139 142 fmt.Printf("%+v\n", evts[0].RepoCommit) 140 143 return fmt.Errorf("events didn't match") ··· 146 149 return nil 147 150 } 148 151 152 + // checks if two XRPCStreamEvent are equal, ignoring sequence numbers and timestamps 149 153 func EqualEvents(a, b *stream.XRPCStreamEvent) bool { 150 - // TODO: these are pretty partial checks (only some messages, not all reflect) 154 + // TODO: this method is pretty manual, and should probably live next to the XRPCStreamEvent code 151 155 if a.RepoCommit != nil { 152 - a.RepoCommit.Seq = 0 153 - if b.RepoCommit != nil { 154 - b.RepoCommit.Seq = 0 156 + if b.RepoCommit == nil { 157 + return false 155 158 } 156 - return reflect.DeepEqual(a.RepoCommit, b.RepoCommit) 157 - } 158 - // TODO: all these need to check seq 159 - if a.RepoSync != b.RepoSync { 160 - return false 161 - } 162 - if a.RepoIdentity != b.RepoIdentity { 163 - return false 164 - } 165 - if a.RepoAccount != b.RepoAccount { 166 - return false 167 - } 168 - if a.Error != b.Error { 169 - return false 159 + if a.RepoCommit.Repo != b.RepoCommit.Repo || 160 + a.RepoCommit.Commit != b.RepoCommit.Commit || 161 + !reflect.DeepEqual(a.RepoCommit.Blocks, b.RepoCommit.Blocks) || 162 + !reflect.DeepEqual(a.RepoCommit.Blobs, b.RepoCommit.Blobs) || 163 + !reflect.DeepEqual(a.RepoCommit.Ops, b.RepoCommit.Ops) || 164 + !reflect.DeepEqual(a.RepoCommit.Since, b.RepoCommit.Since) || 165 + a.RepoCommit.PrevData != b.RepoCommit.PrevData || 166 + a.RepoCommit.Rebase != b.RepoCommit.Rebase || 167 + a.RepoCommit.Rev != b.RepoCommit.Rev || 168 + a.RepoCommit.TooBig != b.RepoCommit.TooBig { 169 + return false 170 + } 171 + return true 172 + } else if a.RepoSync != nil { 173 + if b.RepoSync == nil { 174 + return false 175 + } 176 + if a.RepoSync.Did != b.RepoSync.Did || 177 + !reflect.DeepEqual(a.RepoSync.Blocks, b.RepoSync.Blocks) || 178 + a.RepoSync.Rev != b.RepoSync.Rev { 179 + return false 180 + } 181 + return true 182 + } else if a.RepoIdentity != nil { 183 + if b.RepoIdentity == nil { 184 + return false 185 + } 186 + if a.RepoIdentity.Did != b.RepoIdentity.Did || 187 + !reflect.DeepEqual(a.RepoIdentity.Handle, b.RepoIdentity.Handle) { 188 + return false 189 + } 190 + return true 191 + } else if a.RepoAccount != nil { 192 + if b.RepoAccount == nil { 193 + return false 194 + } 195 + if a.RepoAccount.Did != b.RepoAccount.Did || 196 + a.RepoAccount.Active != b.RepoAccount.Active || 197 + !reflect.DeepEqual(a.RepoAccount.Status, b.RepoAccount.Status) { 198 + return false 199 + } 200 + return true 170 201 } 171 - return true 202 + // NOTE: doesn't support all event types 203 + return false 172 204 }
+33
cmd/relayered/testing/testdata/basic.json
··· 28 28 "frame": { 29 29 "header": { 30 30 "op": 1, 31 + "t": "#identity" 32 + }, 33 + "body": { 34 + "did": "did:plc:44ybard66vv44zksje25o7dz", 35 + "seq": 7278969008, 36 + "time": "2025-04-01T04:01:30.384Z" 37 + } 38 + }, 39 + "drop": false, 40 + "invalid": false, 41 + "update": false 42 + }, 43 + { 44 + "frame": { 45 + "header": { 46 + "op": 1, 47 + "t": "#account" 48 + }, 49 + "body": { 50 + "did": "did:plc:44ybard66vv44zksje25o7dz", 51 + "active": true, 52 + "seq": 7278969009, 53 + "time": "2025-04-01T04:01:31.384Z" 54 + } 55 + }, 56 + "drop": false, 57 + "invalid": false, 58 + "update": false 59 + }, 60 + { 61 + "frame": { 62 + "header": { 63 + "op": 1, 31 64 "t": "#commit" 32 65 }, 33 66 "body": {