Hello there,
I would like to point out some issues with Twitter Lists and the eventual consistency.
I am currently writing integration tests with the api and this is the only part of the system so far that have so many problems with consistency.
Two of them are the following :
Create a list
- Without any delay,
Update the list
The list might or might not be updated.
More problematic is the following:
Update a list
- Without any delay,
Delete the list
The delete operation returns a success but the list was not actually destroyed.
You actually need to have delays between each of the operations.
Here are integration tests that I currently have (they are not yet complete) just so you see how many delays are required for consistency.
[Fact]
public async Task List_CRUD()
{
if (!EndToEndTestConfig.ShouldRunEndToEndTests)
return;
// act
var privateList = await _tweetinviTestClient.Lists.CreateList(new CreateListParameters("private-endToEnd-Tests")
{
PrivacyMode = PrivacyMode.Private,
Description = "private-desc"
});
await Task.Delay(500);
var updatedPrivateList = await _tweetinviTestClient.Lists.UpdateList(new UpdateListParameters(privateList)
{
Name = "new-private-name",
Description = "hello"
});
await Task.Delay(500);
var retrievedPrivateList = await _tweetinviTestClient.Lists.GetList(privateList.Id);
var listFirstCreatedAsPublic = await _tweetinviTestClient.Lists.CreateList("public-endToEnd-Tests", PrivacyMode.Public);
await Task.Delay(500);
var publicListBeforeGoingPrivate = await _tweetinviClient.Lists.GetList(new TwitterListIdentifier(listFirstCreatedAsPublic.Slug, listFirstCreatedAsPublic.Owner));
var listsSubscribedByTweetinviTest = await _tweetinviTestClient.Lists.GetListsSubscribedByAccount();
var listsOwnedByTweetinviTest = await _tweetinviClient.Lists.GetListsOwnedByUserIterator(EndToEndTestConfig.TweetinviTest.AccountId).MoveToNextPage();
await Task.Delay(500);
await listFirstCreatedAsPublic.Update(new ListMetadataParameters
{
PrivacyMode = PrivacyMode.Private
});
// cleanup
await Task.Delay(500);
await retrievedPrivateList.Destroy();
await _tweetinviTestClient.Lists.DestroyList(listFirstCreatedAsPublic);
// assert
Assert.Equal(privateList.Name, "private-endToEnd-Tests");
Assert.Equal(privateList.Description, "private-desc");
Assert.Equal(privateList.PrivacyMode, PrivacyMode.Private);
Assert.Equal(updatedPrivateList.Id, privateList.Id);
Assert.Equal(updatedPrivateList.Description, "hello");
Assert.Equal(retrievedPrivateList.Name, "new-private-name");
Assert.Equal(retrievedPrivateList.Description, "hello");
Assert.Equal(publicListBeforeGoingPrivate.PrivacyMode, PrivacyMode.Public);
Assert.Equal(listFirstCreatedAsPublic.Name, "public-endToEnd-Tests");
Assert.Equal(listFirstCreatedAsPublic.PrivacyMode, PrivacyMode.Private);
Assert.Equal(publicListBeforeGoingPrivate.Name, "public-endToEnd-Tests");
Assert.Contains(listsSubscribedByTweetinviTest, list => { return list.Id == privateList.Id; });
Assert.Contains(listsSubscribedByTweetinviTest, list => { return list.Id == publicListBeforeGoingPrivate.Id; });
Assert.Contains(listsOwnedByTweetinviTest, list => { return list.Id == publicListBeforeGoingPrivate.Id; });
}
1 Like
Thanks for this detective work - I’ll pass this along to the team that works on this area of the API to see if they are aware of these.
system
Closed
#3
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.