- 
                Notifications
    
You must be signed in to change notification settings  - Fork 60
 
          Draft: Federation /messages tests
          #443
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Closed
      
      
    
  
     Closed
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            12 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      e690225
              
                WIP: /messages tests
              
              
                MadLittleMods 737a944
              
                Bigger room and state
              
              
                MadLittleMods 345a469
              
                Merge branch 'main' into madlittlemods/room-messages
              
              
                MadLittleMods 856bbd0
              
                Be able to keep certain homeservers from a blueprint
              
              
                MadLittleMods 8aae43f
              
                Ask for more than 100 so we can see how much backfill gives (answer 100)
              
              
                MadLittleMods 5316e31
              
                Merge branch 'main' into madlittlemods/room-messages
              
              
                MadLittleMods ddaee36
              
                Merge branch 'main' into madlittlemods/room-messages
              
              
                MadLittleMods e10cc44
              
                Merge branch 'main' into madlittlemods/room-messages
              
              
                MadLittleMods 91c5a1c
              
                Merge branch 'main' into madlittlemods/room-messages
              
              
                MadLittleMods bb60b9f
              
                Sprinkle in some state to make it harder
              
              
                MadLittleMods da9d2d0
              
                Lesser test
              
              
                MadLittleMods df1f7b7
              
                Merge branch 'main' into madlittlemods/room-messages
              
              
                MadLittleMods File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| package tests | ||
| 
     | 
||
| import ( | ||
| "net/url" | ||
| "testing" | ||
| "time" | ||
| 
     | 
||
| "github.com/matrix-org/complement/internal/b" | ||
| "github.com/matrix-org/complement/internal/client" | ||
| "github.com/sirupsen/logrus" | ||
| ) | ||
| 
     | 
||
| func TestMessagesOverFederation(t *testing.T) { | ||
| deployment := Deploy(t, b.BlueprintPerfManyMessages) | ||
| defer deployment.Destroy(t) | ||
| 
     | 
||
| alice := deployment.Client(t, "hs1", "@alice:hs1") | ||
| 
     | 
||
| remoteCharlie := deployment.Client(t, "hs2", "@charlie:hs2") | ||
| 
     | 
||
| t.Run("parallel", func(t *testing.T) { | ||
| t.Run("asdf", func(t *testing.T) { | ||
| t.Parallel() | ||
| 
     | 
||
| syncResult, _ := alice.MustSync(t, client.SyncReq{}) | ||
| joinedRooms := syncResult.Get("rooms.join|@keys") | ||
| roomWithManyMessages := joinedRooms.Get("0").String() | ||
| 
     | 
||
| // logrus.WithFields(logrus.Fields{ | ||
| // "joinedRooms": joinedRooms, | ||
| // "roomWithManyMessages": roomWithManyMessages, | ||
| // }).Error("asdf") | ||
| 
     | 
||
| remoteCharlie.JoinRoom(t, roomWithManyMessages, []string{"hs1"}) | ||
| 
     | 
||
| messagesRes := remoteCharlie.MustDoFunc(t, "GET", []string{"_matrix", "client", "r0", "rooms", roomWithManyMessages, "messages"}, client.WithContentType("application/json"), client.WithQueries(url.Values{ | ||
| "dir": []string{"b"}, | ||
| "limit": []string{"100"}, | ||
| })) | ||
| messagesResBody := client.ParseJSON(t, messagesRes) | ||
| eventIDs := client.GetJSONFieldStringArray(t, messagesResBody, "chunk") | ||
| // end := client.GetJSONFieldStringArray(t, messagesResBody, "end") | ||
| 
     | 
||
| logrus.WithFields(logrus.Fields{ | ||
| "joinedRooms": joinedRooms, | ||
| "roomWithManyMessages": roomWithManyMessages, | ||
| "eventIDsLength": len(eventIDs), | ||
| "eventIDs": eventIDs, | ||
| }).Error("asdf") | ||
| 
     | 
||
| // messagesRes2 := remoteCharlie.MustDoFunc(t, "GET", []string{"_matrix", "client", "r0", "rooms", roomWithManyMessages, "messages"}, client.WithContentType("application/json"), client.WithQueries(url.Values{ | ||
| // "dir": []string{"b"}, | ||
| // "from": end, | ||
| // "limit": []string{"500"}, | ||
| // })) | ||
| // messagesResBody2 := client.ParseJSON(t, messagesRes2) | ||
| // eventIDs2 := client.GetJSONFieldStringArray(t, messagesResBody2, "chunk") | ||
| 
     | 
||
| // logrus.WithFields(logrus.Fields{ | ||
| // "joinedRooms": joinedRooms, | ||
| // "roomWithManyMessages": roomWithManyMessages, | ||
| // "eventIDsLength": len(eventIDs2), | ||
| // "eventIDs": eventIDs2, | ||
| // }).Error("asdf2") | ||
| 
     | 
||
| time.Sleep(5 * time.Second) | ||
| }) | ||
| }) | ||
| } | 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.