From 1f42f2582a360624699da1c87557bd86d4abc00d Mon Sep 17 00:00:00 2001 From: Patryk Osmaczko Date: Tue, 27 Feb 2024 08:58:12 +0100 Subject: [PATCH] Revert "Comment out all logged flaky tests" This reverts commit 0bd4a06edc0893752378c1a57b35364144e3e169. --- api/backend_test.go | 9 +-- api/create_account_and_login_test.go | 16 ++-- ...events_owner_without_community_key_test.go | 2 - .../communities_events_token_master_test.go | 4 - protocol/communities_events_utils_test.go | 3 +- protocol/communities_messenger_admin_test.go | 74 ------------------- .../communities_messenger_signers_test.go | 11 +-- protocol/communities_messenger_test.go | 4 - protocol/messenger_backup_test.go | 2 - .../messenger_delete_message_for_me_test.go | 5 +- protocol/messenger_sync_wallets_test.go | 6 +- services/wakuext/api_test.go | 2 - services/web3provider/api_test.go | 2 - transactions/pendingtxtracker_test.go | 7 +- 14 files changed, 18 insertions(+), 129 deletions(-) diff --git a/api/backend_test.go b/api/backend_test.go index f851ed431..c474be3a2 100644 --- a/api/backend_test.go +++ b/api/backend_test.go @@ -1,7 +1,7 @@ package api import ( - //"context" + "context" "crypto/sha256" "database/sql" "encoding/hex" @@ -34,8 +34,7 @@ import ( "github.com/status-im/status-go/protocol/requests" "github.com/status-im/status-go/rpc" "github.com/status-im/status-go/services/typeddata" - - //walletservice "github.com/status-im/status-go/services/wallet" + walletservice "github.com/status-im/status-go/services/wallet" "github.com/status-im/status-go/signal" "github.com/status-im/status-go/sqlite" "github.com/status-im/status-go/t/helpers" @@ -977,7 +976,6 @@ func TestDeleteMultiaccount(t *testing.T) { require.Equal(t, 3, len(files)) } -/* func TestConvertAccount(t *testing.T) { const mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" const password = "111111" // represents password for a regular user @@ -1226,7 +1224,6 @@ func TestConvertAccount(t *testing.T) { require.NoError(t, err) require.Equal(t, 0, len(keycards)) } -*/ func copyFile(srcFolder string, dstFolder string, fileName string, t *testing.T) { data, err := ioutil.ReadFile(path.Join(srcFolder, fileName)) @@ -1366,7 +1363,6 @@ func TestChangeDatabasePassword(t *testing.T) { require.Equal(t, acc.Address, key.Address) } -/* func TestCreateWallet(t *testing.T) { utils.Init() password := "some-password2" // nolint: goconst @@ -1426,7 +1422,6 @@ func TestCreateWallet(t *testing.T) { }) require.NoError(t, err) } -*/ func TestSetFleet(t *testing.T) { utils.Init() diff --git a/api/create_account_and_login_test.go b/api/create_account_and_login_test.go index bb499291f..a8eb3214d 100644 --- a/api/create_account_and_login_test.go +++ b/api/create_account_and_login_test.go @@ -1,15 +1,16 @@ package api -//"encoding/json" -//"fmt" -//"testing" -//"time" +import ( + "encoding/json" + "fmt" + "testing" + "time" -//"github.com/stretchr/testify/require" + "github.com/stretchr/testify/require" -//"github.com/status-im/status-go/protocol/requests" + "github.com/status-im/status-go/protocol/requests" +) -/* func TestCreateAccountAndLogin(t *testing.T) { rootDir := t.TempDir() t.Logf("TestCreateAccountAndLogin: rootDir: %s", rootDir) @@ -60,4 +61,3 @@ func TestCreateAccountAndLogin(t *testing.T) { _, err = statusBackend.CreateAccountAndLogin(&request) require.NoError(t, err) } -*/ diff --git a/protocol/communities_events_owner_without_community_key_test.go b/protocol/communities_events_owner_without_community_key_test.go index 39328a834..66a48c384 100644 --- a/protocol/communities_events_owner_without_community_key_test.go +++ b/protocol/communities_events_owner_without_community_key_test.go @@ -181,7 +181,6 @@ func (s *OwnerWithoutCommunityKeyCommunityEventsSuite) TestOwnerRejectMemberRequ testRejectMemberRequestToJoin(s, community, user) } -/* func (s *OwnerWithoutCommunityKeyCommunityEventsSuite) TestOwnerControlNodeHandlesMultipleEventSenderRequestToJoinDecisions() { additionalOwner := s.newMessenger("", []string{}) community := setUpOnRequestCommunityAndRoles(s, protobuf.CommunityMember_ROLE_OWNER, []*Messenger{additionalOwner}) @@ -190,7 +189,6 @@ func (s *OwnerWithoutCommunityKeyCommunityEventsSuite) TestOwnerControlNodeHandl user := s.newMessenger("", []string{}) testControlNodeHandlesMultipleEventSenderRequestToJoinDecisions(s, community, user, additionalOwner) } -*/ func (s *OwnerWithoutCommunityKeyCommunityEventsSuite) TestOwnerCreateEditDeleteCategories() { community := setUpCommunityAndRoles(s, protobuf.CommunityMember_ROLE_OWNER) diff --git a/protocol/communities_events_token_master_test.go b/protocol/communities_events_token_master_test.go index 0fd8eae5a..c0b9a2ea5 100644 --- a/protocol/communities_events_token_master_test.go +++ b/protocol/communities_events_token_master_test.go @@ -138,13 +138,11 @@ func (s *TokenMasterCommunityEventsSuite) TestTokenMasterCannotCreateBecomeToken testEventSenderCannotCreatePrivilegedCommunityPermission(s, community, protobuf.CommunityTokenPermission_BECOME_TOKEN_MASTER) } -/* func (s *TokenMasterCommunityEventsSuite) TestTokenMasterCannotEditBecomeAdminPermission() { community := setUpCommunityAndRoles(s, protobuf.CommunityMember_ROLE_TOKEN_MASTER) testEventSenderCannotEditPrivilegedCommunityPermission( s, community, protobuf.CommunityTokenPermission_BECOME_ADMIN, protobuf.CommunityTokenPermission_BECOME_TOKEN_MASTER) } -*/ func (s *TokenMasterCommunityEventsSuite) TestTokenMasterCannotEditBecomeTokenMasterPermission() { community := setUpCommunityAndRoles(s, protobuf.CommunityMember_ROLE_TOKEN_MASTER) @@ -203,7 +201,6 @@ func (s *TokenMasterCommunityEventsSuite) TestTokenMasterRejectMemberRequestToJo testRejectMemberRequestToJoin(s, community, user) } -/* func (s *TokenMasterCommunityEventsSuite) TestTokenMasterControlNodeHandlesMultipleEventSenderRequestToJoinDecisions() { additionalTokenMaster := s.newMessenger("qwerty", []string{eventsSenderAccountAddress}) community := setUpOnRequestCommunityAndRoles(s, protobuf.CommunityMember_ROLE_TOKEN_MASTER, []*Messenger{additionalTokenMaster}) @@ -212,7 +209,6 @@ func (s *TokenMasterCommunityEventsSuite) TestTokenMasterControlNodeHandlesMulti user := s.newMessenger("", []string{}) testControlNodeHandlesMultipleEventSenderRequestToJoinDecisions(s, community, user, additionalTokenMaster) } -*/ func (s *TokenMasterCommunityEventsSuite) TestTokenMasterCreateEditDeleteCategories() { community := setUpCommunityAndRoles(s, protobuf.CommunityMember_ROLE_TOKEN_MASTER) diff --git a/protocol/communities_events_utils_test.go b/protocol/communities_events_utils_test.go index 40374bb81..dd7f6cf35 100644 --- a/protocol/communities_events_utils_test.go +++ b/protocol/communities_events_utils_test.go @@ -16,6 +16,7 @@ import ( "github.com/status-im/status-go/protocol/communities/token" "github.com/status-im/status-go/protocol/protobuf" "github.com/status-im/status-go/protocol/requests" + "github.com/status-im/status-go/protocol/tt" "github.com/status-im/status-go/services/communitytokens" "github.com/status-im/status-go/services/wallet/bigint" ) @@ -1405,7 +1406,6 @@ func testRejectMemberRequestToJoin(base CommunityEventsTestsInterface, community s.Require().Len(declinedRequestsPending, 0) } -/* func testControlNodeHandlesMultipleEventSenderRequestToJoinDecisions(base CommunityEventsTestsInterface, community *communities.Community, user *Messenger, additionalEventSender *Messenger) { _, err := user.Start() @@ -1516,7 +1516,6 @@ func testControlNodeHandlesMultipleEventSenderRequestToJoinDecisions(base Commun }) s.Require().NoError(err) } -*/ func testCreateEditDeleteCategories(base CommunityEventsTestsInterface, community *communities.Community) { newCategory := &requests.CreateCommunityCategory{ diff --git a/protocol/communities_messenger_admin_test.go b/protocol/communities_messenger_admin_test.go index 055b914a4..def2e9681 100644 --- a/protocol/communities_messenger_admin_test.go +++ b/protocol/communities_messenger_admin_test.go @@ -211,7 +211,6 @@ func (s *AdminCommunityEventsSuite) TestAdminRejectMemberRequestToJoin() { testRejectMemberRequestToJoin(s, community, user) } -/* func (s *AdminCommunityEventsSuite) TestAdminControlNodeHandlesMultipleEventSenderRequestToJoinDecisions() { additionalAdmin := s.newMessenger("qwerty", []string{eventsSenderAccountAddress}) community := setUpOnRequestCommunityAndRoles(s, protobuf.CommunityMember_ROLE_ADMIN, []*Messenger{additionalAdmin}) @@ -220,7 +219,6 @@ func (s *AdminCommunityEventsSuite) TestAdminControlNodeHandlesMultipleEventSend user := s.newMessenger("", []string{}) testControlNodeHandlesMultipleEventSenderRequestToJoinDecisions(s, community, user, additionalAdmin) } -*/ func (s *AdminCommunityEventsSuite) TestAdminCreateEditDeleteCategories() { community := setUpCommunityAndRoles(s, protobuf.CommunityMember_ROLE_ADMIN) @@ -325,78 +323,6 @@ func (s *AdminCommunityEventsSuite) TestMemberReceiveOwnerEventsWhenControlNodeO testMemberReceiveEventsWhenControlNodeOffline(s, community) } -/* -func (s *AdminCommunityEventsSuite) TestAdminResendRejectedEvents() { - community := setUpCommunityAndRoles(s, protobuf.CommunityMember_ROLE_ADMIN) - - // admin modifies community description - adminEditRequest := &requests.EditCommunity{ - CommunityID: community.ID(), - CreateCommunity: requests.CreateCommunity{ - Name: "admin name", - Description: "admin description", - Color: "#FFFFFF", - Membership: protobuf.CommunityPermissions_MANUAL_ACCEPT, - }, - } - _, err := s.admin.EditCommunity(adminEditRequest) - s.Require().NoError(err) - - // in the meantime, control node updates community description as well - ownerEditRequest := &requests.EditCommunity{ - CommunityID: community.ID(), - CreateCommunity: requests.CreateCommunity{ - Name: "control node name", - Description: "control node description", - Color: "#FFFFFF", - Membership: protobuf.CommunityPermissions_MANUAL_ACCEPT, - }, - } - _, err = s.owner.EditCommunity(ownerEditRequest) - s.Require().NoError(err) - - waitOnAdminEventsRejection := waitOnCommunitiesEvent(s.owner, func(s *communities.Subscription) bool { - return s.CommunityEventsMessageInvalidClock != nil - }) - - // control node receives admin event and rejects it - _, err = WaitOnMessengerResponse(s.owner, func(response *MessengerResponse) bool { - select { - case err := <-waitOnAdminEventsRejection: - s.Require().NoError(err) - return true - default: - return false - } - }, "") - s.Require().NoError(err) - - community, err = s.owner.communitiesManager.GetByID(community.ID()) - s.Require().NoError(err) - s.Require().Equal(ownerEditRequest.Description, community.DescriptionText()) - - // admin receives rejected events and re-applies them - // there is no signal whatsoever, we just wait for admin to process all incoming messages - _, _ = WaitOnMessengerResponse(s.admin, func(response *MessengerResponse) bool { - return false - }, "") - - // control node receives re-applied admin event and accepts it - response, err := WaitOnMessengerResponse(s.owner, func(response *MessengerResponse) bool { - return len(response.Communities()) > 0 - }, "no communities in response") - s.Require().NoError(err) - s.Require().Equal(adminEditRequest.Description, response.Communities()[0].DescriptionText()) - - // admin receives updated community description - response, err = WaitOnMessengerResponse(s.admin, func(response *MessengerResponse) bool { - return len(response.Communities()) > 0 - }, "no communities in response") - s.Require().NoError(err) - s.Require().Equal(adminEditRequest.Description, response.Communities()[0].DescriptionText()) -} -*/ - func (s *AdminCommunityEventsSuite) TestJoinedAdminReceiveRequestsToJoinWithoutRevealedAccounts() { community := setUpOnRequestCommunityAndRoles(s, protobuf.CommunityMember_ROLE_ADMIN, []*Messenger{}) diff --git a/protocol/communities_messenger_signers_test.go b/protocol/communities_messenger_signers_test.go index 7f0d05521..c09e1582e 100644 --- a/protocol/communities_messenger_signers_test.go +++ b/protocol/communities_messenger_signers_test.go @@ -1,15 +1,18 @@ package protocol import ( + "bytes" "context" "testing" "time" + "github.com/golang/protobuf/proto" "github.com/stretchr/testify/suite" "go.uber.org/zap" gethcommon "github.com/ethereum/go-ethereum/common" hexutil "github.com/ethereum/go-ethereum/common/hexutil" + utils "github.com/status-im/status-go/common" gethbridge "github.com/status-im/status-go/eth-node/bridge/geth" "github.com/status-im/status-go/eth-node/types" @@ -577,7 +580,6 @@ func (s *MessengerCommunitiesSignersSuite) TestNewOwnerAcceptRequestToJoin() { } -/* func (s *MessengerCommunitiesSignersSuite) testDescriptionSignature(description []byte) { var amm protobuf.ApplicationMetadataMessage err := proto.Unmarshal(description, &amm) @@ -587,9 +589,7 @@ func (s *MessengerCommunitiesSignersSuite) testDescriptionSignature(description s.Require().NoError(err) s.NotNil(signer) } -*/ -/* func (s *MessengerCommunitiesSignersSuite) forceCommunityChange(community *communities.Community, owner *Messenger, user *Messenger) { newDescription := community.DescriptionText() + " new" _, err := owner.EditCommunity(&requests.EditCommunity{ @@ -609,9 +609,7 @@ func (s *MessengerCommunitiesSignersSuite) forceCommunityChange(community *commu }, "new description not received") s.Require().NoError(err) } -*/ -/* func (s *MessengerCommunitiesSignersSuite) testSyncCommunity(mintOwnerToken bool) { community := s.createCommunity(s.john) s.advertiseCommunityTo(s.john, community, s.alice) @@ -715,9 +713,7 @@ func (s *MessengerCommunitiesSignersSuite) testSyncCommunity(mintOwnerToken bool s.Require().Equal(community.IDString(), responseCommunity.IDString()) s.Require().True(common.IsPubKeyEqual(expectedControlNode, responseCommunity.ControlNode())) } -*/ -/* func (s *MessengerCommunitiesSignersSuite) TestSyncTokenGatedCommunity() { testCases := []struct { name string @@ -739,4 +735,3 @@ func (s *MessengerCommunitiesSignersSuite) TestSyncTokenGatedCommunity() { }) } } -*/ diff --git a/protocol/communities_messenger_test.go b/protocol/communities_messenger_test.go index 753ad78f0..dfaf158c6 100644 --- a/protocol/communities_messenger_test.go +++ b/protocol/communities_messenger_test.go @@ -1178,7 +1178,6 @@ func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccess() { } -/* func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccessWithDeclinedState() { ctx := context.Background() @@ -1430,9 +1429,7 @@ func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccessWithDeclinedSt s.Require().False(notification.Deleted) } -*/ -/* func (s *MessengerCommunitiesSuite) TestCancelRequestAccess() { ctx := context.Background() @@ -1609,7 +1606,6 @@ func (s *MessengerCommunitiesSuite) TestCancelRequestAccess() { s.Require().Equal(communities.RequestToJoinStateCanceled, cancelRequestToJoin2.State) } -*/ func (s *MessengerCommunitiesSuite) TestRequestAccessAgain() { description := &requests.CreateCommunity{ diff --git a/protocol/messenger_backup_test.go b/protocol/messenger_backup_test.go index 0462a625d..5498dccde 100644 --- a/protocol/messenger_backup_test.go +++ b/protocol/messenger_backup_test.go @@ -693,7 +693,6 @@ func (s *MessengerBackupSuite) TestBackupCommunities() { s.Require().Equal(clock, lastBackup) } -/* func (s *MessengerBackupSuite) TestBackupKeypairs() { // Create bob1 bob1 := s.m @@ -747,7 +746,6 @@ func (s *MessengerBackupSuite) TestBackupKeypairs() { s.Require().NoError(err) s.Require().True(accounts.SameKeypairsWithDifferentSyncedFrom(seedKp, dbSeedKp2, false, accounts.SyncedFromBackup, accounts.AccountNonOperable)) } -*/ func (s *MessengerBackupSuite) TestBackupKeycards() { // Create bob1 diff --git a/protocol/messenger_delete_message_for_me_test.go b/protocol/messenger_delete_message_for_me_test.go index eb5f13bac..829ce7932 100644 --- a/protocol/messenger_delete_message_for_me_test.go +++ b/protocol/messenger_delete_message_for_me_test.go @@ -3,8 +3,7 @@ package protocol import ( "context" "crypto/ecdsa" - - //"errors" + "errors" "testing" "github.com/stretchr/testify/suite" @@ -106,7 +105,6 @@ func (s *MessengerDeleteMessageForMeSuite) Pair() { s.Require().NoError(err) } -/* func (s *MessengerDeleteMessageForMeSuite) TestDeleteMessageForMe() { s.Pair() chatID := "foobarsynctest" @@ -209,7 +207,6 @@ func (s *MessengerDeleteMessageForMeSuite) TestDeleteMessageForMe() { s.Require().NoError(err) s.Require().False(otherMessage.DeletedForMe) } -*/ func (s *MessengerDeleteMessageForMeSuite) TestDeleteImageMessageFromReceiverSide() { diff --git a/protocol/messenger_sync_wallets_test.go b/protocol/messenger_sync_wallets_test.go index 9b7c36a41..c8749fc5a 100644 --- a/protocol/messenger_sync_wallets_test.go +++ b/protocol/messenger_sync_wallets_test.go @@ -445,7 +445,6 @@ func (s *MessengerSyncWalletSuite) TestSyncWalletAccountsReorder() { s.Require().Equal(dbClock, dbClockOtherDevice) } -/* func (s *MessengerSyncWalletSuite) TestSyncWalletAccountOrderAfterDeletion() { profileKp := accounts.GetProfileKeypairForTest(true, true, true) // set clocks for accounts @@ -545,11 +544,9 @@ func (s *MessengerSyncWalletSuite) TestSyncWalletAccountOrderAfterDeletion() { return err } - // we don't include chat account in position ordering if len(response.Keypairs) != 3 || // 3 keypairs (profile, seed, priv key) len(response.WatchOnlyAccounts) != len(woAccounts) || - len(response.AccountsPositions) != totalNumOfAccounts-1 - { + len(response.AccountsPositions) != totalNumOfAccounts-1 /* we don't include chat account in position ordering*/ { return errors.New("no sync wallet account received") } return nil @@ -622,4 +619,3 @@ func (s *MessengerSyncWalletSuite) TestSyncWalletAccountOrderAfterDeletion() { s.Require().True(haveSameElements(dbAccounts1, dbAccounts2, accounts.SameAccountsIncludingPosition)) } -*/ diff --git a/services/wakuext/api_test.go b/services/wakuext/api_test.go index e829b110c..d20ac095d 100644 --- a/services/wakuext/api_test.go +++ b/services/wakuext/api_test.go @@ -239,7 +239,6 @@ func (s *ShhExtSuite) TearDownTest() { s.services = nil } -/* func (s *ShhExtSuite) TestRequestMessagesSuccess() { // two nodes needed: client and mailserver s.createAndAddNode() @@ -257,7 +256,6 @@ func (s *ShhExtSuite) TestRequestMessagesSuccess() { }) s.NoError(err) } -*/ func (s *ShhExtSuite) TestMultipleRequestMessagesWithoutForce() { // two nodes needed: client and mailserver diff --git a/services/web3provider/api_test.go b/services/web3provider/api_test.go index d265c41e7..3e493fa46 100644 --- a/services/web3provider/api_test.go +++ b/services/web3provider/api_test.go @@ -124,7 +124,6 @@ func TestRequestPermission(t *testing.T) { require.Error(t, err) } -/* func TestWeb3Call(t *testing.T) { api, cancel := setupTestAPI(t) defer cancel() @@ -166,7 +165,6 @@ func TestWeb3Call(t *testing.T) { require.NoError(t, err) require.Equal(t, data, response.Result.(JSONRPCResponse).Result) } -*/ func TestWeb3Signature(t *testing.T) { api, cancel := setupTestAPI(t) diff --git a/transactions/pendingtxtracker_test.go b/transactions/pendingtxtracker_test.go index 84386eb1f..9c46cd38e 100644 --- a/transactions/pendingtxtracker_test.go +++ b/transactions/pendingtxtracker_test.go @@ -2,11 +2,10 @@ package transactions import ( "context" - //"database/sql" + "database/sql" "encoding/json" "math/big" - - //"sync" + "sync" "testing" "time" @@ -423,7 +422,6 @@ func TestPendingTxTracker_Watch(t *testing.T) { sub.Unsubscribe() } -/* func TestPendingTxTracker_Watch_StatusChangeIncrementally(t *testing.T) { m, stop, chainClient, eventFeed := setupTestTransactionDB(t, common.NewAndSet(1*time.Nanosecond)) defer stop() @@ -538,7 +536,6 @@ func TestPendingTxTracker_Watch_StatusChangeIncrementally(t *testing.T) { sub.Unsubscribe() } -*/ func TestPendingTransactions(t *testing.T) { manager, stop, _, _ := setupTestTransactionDB(t, nil)