2024-06-13 22:31:09 +00:00
|
|
|
package telemetry
|
|
|
|
|
|
|
|
import (
|
2024-06-28 10:24:04 +00:00
|
|
|
"context"
|
2024-06-13 22:31:09 +00:00
|
|
|
"encoding/json"
|
2024-07-12 20:37:55 +00:00
|
|
|
"errors"
|
2024-06-13 22:31:09 +00:00
|
|
|
"net/http"
|
|
|
|
"net/http/httptest"
|
2024-06-28 10:24:04 +00:00
|
|
|
"os"
|
2024-07-12 20:37:55 +00:00
|
|
|
"slices"
|
2024-06-28 10:24:04 +00:00
|
|
|
"sync"
|
2024-06-13 22:31:09 +00:00
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"go.uber.org/zap"
|
|
|
|
"google.golang.org/protobuf/proto"
|
|
|
|
|
2024-09-03 11:39:49 +00:00
|
|
|
"github.com/waku-org/go-waku/waku/v2/api/publish"
|
2024-06-19 10:40:52 +00:00
|
|
|
v2protocol "github.com/waku-org/go-waku/waku/v2/protocol"
|
|
|
|
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
|
|
|
|
2024-06-28 10:24:04 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
2024-06-13 22:31:09 +00:00
|
|
|
"github.com/status-im/status-go/eth-node/types"
|
|
|
|
"github.com/status-im/status-go/protocol/transport"
|
2024-07-12 20:37:55 +00:00
|
|
|
"github.com/status-im/status-go/protocol/tt"
|
2024-06-13 22:31:09 +00:00
|
|
|
v1protocol "github.com/status-im/status-go/protocol/v1"
|
|
|
|
"github.com/status-im/status-go/wakuv2"
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
"github.com/status-im/status-go/wakuv2/common"
|
2024-06-13 22:31:09 +00:00
|
|
|
)
|
|
|
|
|
2024-06-28 10:24:04 +00:00
|
|
|
var (
|
|
|
|
testContentTopic = "/waku/1/0x12345679/rfc26"
|
|
|
|
)
|
|
|
|
|
2024-07-12 20:37:55 +00:00
|
|
|
func createMockServer(t *testing.T, wg *sync.WaitGroup, expectedType TelemetryType, expectedCondition func(received []TelemetryRequest) (shouldSucceed bool, shouldFail bool)) *httptest.Server {
|
2024-06-13 22:31:09 +00:00
|
|
|
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if r.Method != "POST" {
|
|
|
|
t.Errorf("Expected 'POST' request, got '%s'", r.Method)
|
|
|
|
}
|
|
|
|
if r.URL.EscapedPath() != "/record-metrics" {
|
|
|
|
t.Errorf("Expected request to '/record-metrics', got '%s'", r.URL.EscapedPath())
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check the request body is as expected
|
|
|
|
var received []TelemetryRequest
|
|
|
|
err := json.NewDecoder(r.Body).Decode(&received)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2024-07-12 20:37:55 +00:00
|
|
|
if expectedCondition != nil {
|
|
|
|
shouldSucceed, shouldFail := expectedCondition(received)
|
|
|
|
if shouldFail {
|
|
|
|
w.WriteHeader(http.StatusInternalServerError)
|
|
|
|
t.Fail()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if !shouldSucceed {
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
return
|
|
|
|
}
|
2024-06-13 22:31:09 +00:00
|
|
|
} else {
|
2024-07-12 20:37:55 +00:00
|
|
|
if len(received) != 1 {
|
|
|
|
t.Errorf("Unexpected data received: %+v", received)
|
2024-06-28 10:24:04 +00:00
|
|
|
} else {
|
2024-07-12 20:37:55 +00:00
|
|
|
if received[0].TelemetryType != expectedType {
|
|
|
|
t.Errorf("Unexpected telemetry type: got %v, want %v", received[0].TelemetryType, expectedType)
|
|
|
|
}
|
2024-06-28 10:24:04 +00:00
|
|
|
}
|
2024-06-13 22:31:09 +00:00
|
|
|
}
|
2024-07-12 20:37:55 +00:00
|
|
|
// If the data is as expected, respond with success
|
|
|
|
t.Log("Responding with success")
|
|
|
|
responseBody := []map[string]interface{}{
|
|
|
|
{"status": "created"},
|
|
|
|
}
|
|
|
|
body, err := json.Marshal(responseBody)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Failed to marshal response body: %v", err)
|
|
|
|
}
|
|
|
|
w.WriteHeader(http.StatusCreated)
|
|
|
|
_, err = w.Write(body)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Failed to write response body: %v", err)
|
|
|
|
}
|
|
|
|
wg.Done()
|
2024-06-13 22:31:09 +00:00
|
|
|
}))
|
|
|
|
}
|
|
|
|
|
2024-06-28 10:24:04 +00:00
|
|
|
func createClient(t *testing.T, mockServerURL string) *Client {
|
2024-06-13 22:31:09 +00:00
|
|
|
config := zap.NewDevelopmentConfig()
|
|
|
|
config.Level = zap.NewAtomicLevelAt(zap.DebugLevel)
|
|
|
|
logger, err := config.Build()
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Failed to create logger: %v", err)
|
|
|
|
}
|
2024-08-01 03:27:43 +00:00
|
|
|
return NewClient(logger, mockServerURL, "testUID", "testNode", "1.0", WithSendPeriod(100*time.Millisecond), WithPeerID("16Uiu2HAkvWiyFsgRhuJEb9JfjYxEkoHLgnUQmr1N5mKWnYjxYRVm"))
|
2024-06-28 10:24:04 +00:00
|
|
|
}
|
|
|
|
|
2024-07-12 20:37:55 +00:00
|
|
|
type expectedCondition func(received []TelemetryRequest) (shouldSucceed bool, shouldFail bool)
|
|
|
|
|
|
|
|
func withMockServer(t *testing.T, expectedType TelemetryType, expectedCondition expectedCondition, testFunc func(ctx context.Context, t *testing.T, client *Client, wg *sync.WaitGroup)) {
|
2024-06-28 10:24:04 +00:00
|
|
|
var wg sync.WaitGroup
|
|
|
|
wg.Add(1) // Expecting one request
|
|
|
|
|
2024-07-12 20:37:55 +00:00
|
|
|
mockServer := createMockServer(t, &wg, expectedType, expectedCondition)
|
2024-06-28 10:24:04 +00:00
|
|
|
defer mockServer.Close()
|
|
|
|
|
|
|
|
client := createClient(t, mockServer.URL)
|
|
|
|
|
2024-07-01 18:08:54 +00:00
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
testFunc(ctx, t, client, &wg)
|
2024-06-28 10:24:04 +00:00
|
|
|
|
|
|
|
// Wait for the request to be received
|
|
|
|
wg.Wait()
|
|
|
|
}
|
|
|
|
|
2024-09-26 21:17:11 +00:00
|
|
|
func sendEnvelope(ctx context.Context, client *Client) {
|
|
|
|
client.PushSentEnvelope(ctx, wakuv2.SentEnvelope{
|
|
|
|
Envelope: v2protocol.NewEnvelope(&pb.WakuMessage{
|
|
|
|
Payload: []byte{1, 2, 3, 4, 5},
|
|
|
|
ContentTopic: testContentTopic,
|
|
|
|
Version: proto.Uint32(0),
|
|
|
|
Timestamp: proto.Int64(time.Now().Unix()),
|
|
|
|
}, 0, ""),
|
|
|
|
PublishMethod: publish.LightPush,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-06-28 10:24:04 +00:00
|
|
|
func TestClient_ProcessReceivedMessages(t *testing.T) {
|
2024-07-12 20:37:55 +00:00
|
|
|
withMockServer(t, ReceivedMessagesMetric, nil, func(ctx context.Context, t *testing.T, client *Client, wg *sync.WaitGroup) {
|
2024-06-28 10:24:04 +00:00
|
|
|
// Create a telemetry request to send
|
|
|
|
data := ReceivedMessages{
|
|
|
|
Filter: transport.Filter{
|
|
|
|
ChatID: "testChat",
|
|
|
|
PubsubTopic: "testTopic",
|
|
|
|
ContentTopic: types.StringToTopic(testContentTopic),
|
|
|
|
},
|
|
|
|
SSHMessage: &types.Message{
|
|
|
|
Hash: []byte("hash"),
|
|
|
|
Timestamp: uint32(time.Now().Unix()),
|
|
|
|
},
|
|
|
|
Messages: []*v1protocol.StatusMessage{
|
|
|
|
{
|
|
|
|
ApplicationLayer: v1protocol.ApplicationLayer{
|
|
|
|
ID: types.HexBytes("123"),
|
|
|
|
Type: 1,
|
|
|
|
},
|
2024-06-13 22:31:09 +00:00
|
|
|
},
|
|
|
|
},
|
2024-06-28 10:24:04 +00:00
|
|
|
}
|
2024-06-13 22:31:09 +00:00
|
|
|
|
2024-06-28 10:24:04 +00:00
|
|
|
// Send the telemetry request
|
2024-07-01 18:08:54 +00:00
|
|
|
client.Start(ctx)
|
2024-08-12 21:30:13 +00:00
|
|
|
client.PushReceivedMessages(ctx, data)
|
2024-06-28 10:24:04 +00:00
|
|
|
})
|
2024-06-13 22:31:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestClient_ProcessSentEnvelope(t *testing.T) {
|
2024-07-12 20:37:55 +00:00
|
|
|
withMockServer(t, SentEnvelopeMetric, nil, func(ctx context.Context, t *testing.T, client *Client, wg *sync.WaitGroup) {
|
2024-06-28 10:24:04 +00:00
|
|
|
// Send the telemetry request
|
2024-07-01 18:08:54 +00:00
|
|
|
client.Start(ctx)
|
2024-09-26 21:17:11 +00:00
|
|
|
sendEnvelope(ctx, client)
|
2024-06-28 10:24:04 +00:00
|
|
|
})
|
|
|
|
}
|
2024-06-13 22:31:09 +00:00
|
|
|
|
2024-06-28 10:24:04 +00:00
|
|
|
var (
|
2024-07-11 14:37:16 +00:00
|
|
|
testENRBootstrap = "enrtree://AI4W5N5IFEUIHF5LESUAOSMV6TKWF2MB6GU2YK7PU4TYUGUNOCEPW@store.staging.status.nodes.status.im"
|
2024-06-28 10:24:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestTelemetryUponPublishError(t *testing.T) {
|
2024-07-12 20:37:55 +00:00
|
|
|
withMockServer(t, ErrorSendingEnvelopeMetric, nil, func(ctx context.Context, t *testing.T, client *Client, wg *sync.WaitGroup) {
|
2024-06-28 10:24:04 +00:00
|
|
|
enrTreeAddress := testENRBootstrap
|
|
|
|
envEnrTreeAddress := os.Getenv("ENRTREE_ADDRESS")
|
|
|
|
if envEnrTreeAddress != "" {
|
|
|
|
enrTreeAddress = envEnrTreeAddress
|
|
|
|
}
|
|
|
|
|
|
|
|
wakuConfig := &wakuv2.Config{}
|
|
|
|
wakuConfig.Port = 0
|
|
|
|
wakuConfig.EnablePeerExchangeClient = true
|
|
|
|
wakuConfig.LightClient = true
|
|
|
|
wakuConfig.EnableDiscV5 = false
|
|
|
|
wakuConfig.DiscV5BootstrapNodes = []string{enrTreeAddress}
|
|
|
|
wakuConfig.DiscoveryLimit = 20
|
|
|
|
wakuConfig.ClusterID = 16
|
|
|
|
wakuConfig.WakuNodes = []string{enrTreeAddress}
|
|
|
|
wakuConfig.TelemetryServerURL = client.serverURL
|
|
|
|
wakuConfig.TelemetrySendPeriodMs = 500
|
|
|
|
w, err := wakuv2.New(nil, "", wakuConfig, nil, nil, nil, nil, nil)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2024-07-01 18:08:54 +00:00
|
|
|
client.Start(ctx)
|
2024-06-28 10:24:04 +00:00
|
|
|
w.SetStatusTelemetryClient(client)
|
|
|
|
|
|
|
|
// Setting this forces the publish function to fail when sending a message
|
|
|
|
w.SkipPublishToTopic(true)
|
|
|
|
|
|
|
|
err = w.Start()
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
msg := &pb.WakuMessage{
|
2024-06-13 22:31:09 +00:00
|
|
|
Payload: []byte{1, 2, 3, 4, 5},
|
2024-06-28 10:24:04 +00:00
|
|
|
ContentTopic: testContentTopic,
|
2024-06-13 22:31:09 +00:00
|
|
|
Version: proto.Uint32(0),
|
|
|
|
Timestamp: proto.Int64(time.Now().Unix()),
|
2024-06-28 10:24:04 +00:00
|
|
|
}
|
2024-06-13 22:31:09 +00:00
|
|
|
|
2024-06-28 10:24:04 +00:00
|
|
|
// This should result in a single request sent by the telemetry client
|
2024-08-01 18:36:25 +00:00
|
|
|
_, err = w.Send(wakuConfig.DefaultShardPubsubTopic, msg, nil)
|
2024-06-28 10:24:04 +00:00
|
|
|
require.NoError(t, err)
|
|
|
|
})
|
2024-06-13 22:31:09 +00:00
|
|
|
}
|
2024-07-01 18:08:54 +00:00
|
|
|
|
|
|
|
func TestRetryCache(t *testing.T) {
|
|
|
|
counter := 0
|
|
|
|
var wg sync.WaitGroup
|
|
|
|
wg.Add(2)
|
|
|
|
|
|
|
|
mockServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if r.Method != "POST" {
|
|
|
|
t.Errorf("Expected 'POST' request, got '%s'", r.Method)
|
|
|
|
}
|
|
|
|
if r.URL.EscapedPath() != "/record-metrics" {
|
|
|
|
t.Errorf("Expected request to '/record-metrics', got '%s'", r.URL.EscapedPath())
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check the request body is as expected
|
|
|
|
var received []TelemetryRequest
|
|
|
|
err := json.NewDecoder(r.Body).Decode(&received)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fail for the first request to make telemetry cache grow
|
|
|
|
if counter < 1 {
|
|
|
|
counter++
|
|
|
|
w.WriteHeader(http.StatusInternalServerError)
|
|
|
|
wg.Done()
|
|
|
|
} else {
|
|
|
|
t.Log("Counter reached, responding with success")
|
|
|
|
if len(received) == 4 {
|
2024-07-12 20:37:55 +00:00
|
|
|
w.WriteHeader(http.StatusCreated)
|
|
|
|
responseBody := []map[string]interface{}{
|
|
|
|
{"status": "created"},
|
|
|
|
}
|
|
|
|
body, err := json.Marshal(responseBody)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Failed to marshal response body: %v", err)
|
|
|
|
}
|
|
|
|
w.WriteHeader(http.StatusCreated)
|
|
|
|
_, err = w.Write(body)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Failed to write response body: %v", err)
|
|
|
|
}
|
2024-07-01 18:08:54 +00:00
|
|
|
wg.Done()
|
|
|
|
} else {
|
|
|
|
t.Fatalf("Expected 4 metrics, got %d", len(received)-1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
defer mockServer.Close()
|
|
|
|
|
2024-08-12 21:30:13 +00:00
|
|
|
ctx := context.Background()
|
|
|
|
|
2024-07-01 18:08:54 +00:00
|
|
|
client := createClient(t, mockServer.URL)
|
2024-08-12 21:30:13 +00:00
|
|
|
client.Start(ctx)
|
2024-07-01 18:08:54 +00:00
|
|
|
|
|
|
|
for i := 0; i < 3; i++ {
|
2024-09-26 21:17:11 +00:00
|
|
|
sendEnvelope(ctx, client)
|
2024-07-01 18:08:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
time.Sleep(110 * time.Millisecond)
|
|
|
|
|
|
|
|
require.Equal(t, 3, len(client.telemetryRetryCache))
|
|
|
|
|
2024-09-26 21:17:11 +00:00
|
|
|
sendEnvelope(ctx, client)
|
2024-07-01 18:08:54 +00:00
|
|
|
|
|
|
|
wg.Wait()
|
|
|
|
|
|
|
|
time.Sleep(100 * time.Millisecond)
|
|
|
|
|
|
|
|
require.Equal(t, 0, len(client.telemetryRetryCache))
|
|
|
|
}
|
2024-07-12 01:07:23 +00:00
|
|
|
|
|
|
|
func TestRetryCacheCleanup(t *testing.T) {
|
2024-08-12 21:30:13 +00:00
|
|
|
ctx := context.Background()
|
|
|
|
|
2024-07-12 01:07:23 +00:00
|
|
|
client := createClient(t, "")
|
|
|
|
|
|
|
|
for i := 0; i < 6000; i++ {
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
go sendEnvelope(ctx, client)
|
|
|
|
telemetryRequest := <-client.telemetryCh
|
|
|
|
client.telemetryCache = append(client.telemetryCache, telemetryRequest)
|
2024-07-12 01:07:23 +00:00
|
|
|
}
|
|
|
|
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
err := client.pushTelemetryRequest(client.telemetryCache)
|
|
|
|
// For this test case an error when pushing to the server is fine
|
|
|
|
require.Error(t, err)
|
2024-07-12 01:07:23 +00:00
|
|
|
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
client.telemetryCache = nil
|
2024-07-12 01:07:23 +00:00
|
|
|
require.Equal(t, 6000, len(client.telemetryRetryCache))
|
|
|
|
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
go sendEnvelope(ctx, client)
|
|
|
|
telemetryRequest := <-client.telemetryCh
|
|
|
|
client.telemetryCache = append(client.telemetryCache, telemetryRequest)
|
|
|
|
|
|
|
|
err = client.pushTelemetryRequest(client.telemetryCache)
|
|
|
|
require.Error(t, err)
|
2024-07-12 01:07:23 +00:00
|
|
|
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
telemetryRequests := make([]TelemetryRequest, len(client.telemetryCache))
|
|
|
|
copy(telemetryRequests, client.telemetryCache)
|
|
|
|
client.telemetryCache = nil
|
|
|
|
|
|
|
|
err = client.pushTelemetryRequest(telemetryRequests)
|
|
|
|
require.Error(t, err)
|
2024-07-12 01:07:23 +00:00
|
|
|
|
|
|
|
require.Equal(t, 5001, len(client.telemetryRetryCache))
|
|
|
|
}
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
|
2024-07-12 20:37:55 +00:00
|
|
|
func setDefaultConfig(config *wakuv2.Config, lightMode bool) {
|
|
|
|
config.ClusterID = 16
|
|
|
|
|
|
|
|
if lightMode {
|
|
|
|
config.EnablePeerExchangeClient = true
|
|
|
|
config.LightClient = true
|
|
|
|
config.EnableDiscV5 = false
|
|
|
|
} else {
|
|
|
|
config.EnableDiscV5 = true
|
|
|
|
config.EnablePeerExchangeServer = true
|
|
|
|
config.LightClient = false
|
|
|
|
config.EnablePeerExchangeClient = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var testStoreENRBootstrap = "enrtree://AI4W5N5IFEUIHF5LESUAOSMV6TKWF2MB6GU2YK7PU4TYUGUNOCEPW@store.staging.shards.nodes.status.im"
|
|
|
|
|
|
|
|
func TestPeerCount(t *testing.T) {
|
2024-09-19 04:43:04 +00:00
|
|
|
// t.Skip("flaky test")
|
2024-07-27 09:27:26 +00:00
|
|
|
|
2024-07-12 20:37:55 +00:00
|
|
|
expectedCondition := func(received []TelemetryRequest) (shouldSucceed bool, shouldFail bool) {
|
|
|
|
found := slices.ContainsFunc(received, func(req TelemetryRequest) bool {
|
|
|
|
t.Log(req)
|
|
|
|
return req.TelemetryType == PeerCountMetric
|
|
|
|
})
|
|
|
|
return found, false
|
|
|
|
}
|
|
|
|
withMockServer(t, PeerCountMetric, expectedCondition, func(ctx context.Context, t *testing.T, client *Client, wg *sync.WaitGroup) {
|
|
|
|
config := &wakuv2.Config{}
|
|
|
|
setDefaultConfig(config, false)
|
|
|
|
config.DiscV5BootstrapNodes = []string{testStoreENRBootstrap}
|
|
|
|
config.DiscoveryLimit = 20
|
2024-09-19 04:43:04 +00:00
|
|
|
config.TelemetryServerURL = client.serverURL
|
|
|
|
config.TelemetrySendPeriodMs = 1500
|
|
|
|
config.TelemetryPeerCountSendPeriod = 1500
|
2024-07-12 20:37:55 +00:00
|
|
|
w, err := wakuv2.New(nil, "shards.staging", config, nil, nil, nil, nil, nil)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
w.SetStatusTelemetryClient(client)
|
|
|
|
client.Start(ctx)
|
|
|
|
|
|
|
|
require.NoError(t, w.Start())
|
|
|
|
|
|
|
|
err = tt.RetryWithBackOff(func() error {
|
|
|
|
if len(w.Peers()) == 0 {
|
|
|
|
return errors.New("no peers discovered")
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
})
|
|
|
|
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
require.NotEqual(t, 0, len(w.Peers()))
|
|
|
|
})
|
|
|
|
}
|
2024-08-01 03:27:43 +00:00
|
|
|
|
|
|
|
func TestPeerId(t *testing.T) {
|
|
|
|
expectedCondition := func(received []TelemetryRequest) (shouldSucceed bool, shouldFail bool) {
|
|
|
|
var data map[string]interface{}
|
|
|
|
|
|
|
|
err := json.Unmarshal(*received[0].TelemetryData, &data)
|
|
|
|
if err != nil {
|
|
|
|
return false, true
|
|
|
|
}
|
|
|
|
|
|
|
|
_, ok := data["peerId"]
|
|
|
|
require.True(t, ok)
|
|
|
|
return ok, false
|
|
|
|
}
|
2024-09-26 21:17:11 +00:00
|
|
|
withMockServer(t, SentEnvelopeMetric, expectedCondition, func(ctx context.Context, t *testing.T, client *Client, wg *sync.WaitGroup) {
|
|
|
|
// Send the telemetry request
|
2024-08-01 03:27:43 +00:00
|
|
|
client.Start(ctx)
|
2024-09-26 21:17:11 +00:00
|
|
|
sendEnvelope(ctx, client)
|
2024-08-01 03:27:43 +00:00
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
2024-09-19 04:43:04 +00:00
|
|
|
|
|
|
|
func TestPeerCountByShard(t *testing.T) {
|
|
|
|
expectedCondition := func(received []TelemetryRequest) (shouldSucceed bool, shouldFail bool) {
|
|
|
|
found := slices.ContainsFunc(received, func(req TelemetryRequest) bool {
|
|
|
|
return req.TelemetryType == PeerCountByShardMetric
|
|
|
|
})
|
|
|
|
return found, false
|
|
|
|
}
|
|
|
|
withMockServer(t, PeerCountByShardMetric, expectedCondition, func(ctx context.Context, t *testing.T, client *Client, wg *sync.WaitGroup) {
|
|
|
|
config := &wakuv2.Config{}
|
|
|
|
setDefaultConfig(config, false)
|
|
|
|
config.DiscV5BootstrapNodes = []string{testStoreENRBootstrap}
|
|
|
|
config.DiscoveryLimit = 20
|
|
|
|
config.TelemetryServerURL = client.serverURL
|
|
|
|
config.TelemetryPeerCountSendPeriod = 1500
|
|
|
|
config.TelemetrySendPeriodMs = 1500
|
|
|
|
w, err := wakuv2.New(nil, "shards.staging", config, nil, nil, nil, nil, nil)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
w.SetStatusTelemetryClient(client)
|
|
|
|
client.Start(ctx)
|
|
|
|
|
|
|
|
require.NoError(t, w.Start())
|
|
|
|
|
|
|
|
err = tt.RetryWithBackOff(func() error {
|
|
|
|
if len(w.Peers()) == 0 {
|
|
|
|
return errors.New("no peers discovered")
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
})
|
|
|
|
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
require.NotEqual(t, 0, len(w.Peers()))
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestPeerCountByOrigin(t *testing.T) {
|
|
|
|
expectedCondition := func(received []TelemetryRequest) (shouldSucceed bool, shouldFail bool) {
|
|
|
|
found := slices.ContainsFunc(received, func(req TelemetryRequest) bool {
|
|
|
|
return req.TelemetryType == PeerCountByOriginMetric
|
|
|
|
})
|
|
|
|
return found, false
|
|
|
|
}
|
|
|
|
withMockServer(t, PeerCountByOriginMetric, expectedCondition, func(ctx context.Context, t *testing.T, client *Client, wg *sync.WaitGroup) {
|
|
|
|
config := &wakuv2.Config{}
|
|
|
|
setDefaultConfig(config, false)
|
|
|
|
config.DiscV5BootstrapNodes = []string{testStoreENRBootstrap}
|
|
|
|
config.DiscoveryLimit = 20
|
|
|
|
config.TelemetryServerURL = client.serverURL
|
|
|
|
config.TelemetryPeerCountSendPeriod = 1500
|
|
|
|
config.TelemetrySendPeriodMs = 1500
|
|
|
|
w, err := wakuv2.New(nil, "shards.staging", config, nil, nil, nil, nil, nil)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
w.SetStatusTelemetryClient(client)
|
|
|
|
client.Start(ctx)
|
|
|
|
|
|
|
|
require.NoError(t, w.Start())
|
|
|
|
|
|
|
|
err = tt.RetryWithBackOff(func() error {
|
|
|
|
if len(w.Peers()) == 0 {
|
|
|
|
return errors.New("no peers discovered")
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
})
|
|
|
|
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
require.NotEqual(t, 0, len(w.Peers()))
|
|
|
|
})
|
|
|
|
}
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
|
|
|
|
type testCase struct {
|
|
|
|
name string
|
|
|
|
input interface{}
|
|
|
|
expectedType TelemetryType
|
|
|
|
expectedFields map[string]interface{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func runTestCase(t *testing.T, tc testCase) {
|
|
|
|
ctx := context.Background()
|
|
|
|
client := createClient(t, "")
|
|
|
|
|
|
|
|
go client.processAndPushTelemetry(ctx, tc.input)
|
|
|
|
|
|
|
|
telemetryRequest := <-client.telemetryCh
|
|
|
|
|
|
|
|
require.Equal(t, tc.expectedType, telemetryRequest.TelemetryType, "Unexpected telemetry type")
|
|
|
|
|
|
|
|
var telemetryData map[string]interface{}
|
|
|
|
err := json.Unmarshal(*telemetryRequest.TelemetryData, &telemetryData)
|
|
|
|
require.NoError(t, err, "Failed to unmarshal telemetry data")
|
|
|
|
|
|
|
|
for key, value := range tc.expectedFields {
|
|
|
|
require.Equal(t, value, telemetryData[key], "Unexpected value for %s", key)
|
|
|
|
}
|
|
|
|
|
|
|
|
require.Contains(t, telemetryData, "nodeName", "Missing nodeName in telemetry data")
|
|
|
|
require.Contains(t, telemetryData, "peerId", "Missing peerId in telemetry data")
|
|
|
|
require.Contains(t, telemetryData, "statusVersion", "Missing statusVersion in telemetry data")
|
|
|
|
require.Contains(t, telemetryData, "deviceType", "Missing deviceType in telemetry data")
|
|
|
|
require.Contains(t, telemetryData, "timestamp", "Missing timestamp in telemetry data")
|
|
|
|
|
|
|
|
// Simulate pushing the telemetry request
|
|
|
|
client.telemetryCache = append(client.telemetryCache, telemetryRequest)
|
|
|
|
|
|
|
|
err = client.pushTelemetryRequest(client.telemetryCache)
|
|
|
|
// For this test case, we expect an error when pushing to the server
|
|
|
|
require.Error(t, err)
|
|
|
|
|
|
|
|
// Verify that the request is now in the retry cache
|
|
|
|
require.Equal(t, 1, len(client.telemetryRetryCache), "Expected one item in telemetry retry cache")
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestProcessMessageDeliveryConfirmed(t *testing.T) {
|
|
|
|
tc := testCase{
|
|
|
|
name: "MessageDeliveryConfirmed",
|
|
|
|
input: MessageDeliveryConfirmed{
|
|
|
|
MessageHash: "0x1234567890abcdef",
|
|
|
|
},
|
|
|
|
expectedType: MessageDeliveryConfirmedMetric,
|
|
|
|
expectedFields: map[string]interface{}{
|
|
|
|
"messageHash": "0x1234567890abcdef",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
runTestCase(t, tc)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestProcessMissedRelevantMessage(t *testing.T) {
|
|
|
|
now := time.Now()
|
|
|
|
message := common.NewReceivedMessage(
|
|
|
|
v2protocol.NewEnvelope(
|
|
|
|
&pb.WakuMessage{
|
|
|
|
Payload: []byte{1, 2, 3, 4, 5},
|
|
|
|
ContentTopic: testContentTopic,
|
|
|
|
Version: proto.Uint32(0),
|
|
|
|
Timestamp: proto.Int64(now.Unix()),
|
|
|
|
}, 0, ""),
|
|
|
|
common.MissingMessageType,
|
|
|
|
)
|
|
|
|
tc := testCase{
|
|
|
|
name: "MissedRelevantMessage",
|
|
|
|
input: MissedRelevantMessage{
|
|
|
|
ReceivedMessage: message,
|
|
|
|
},
|
|
|
|
expectedType: MissedRelevantMessageMetric,
|
|
|
|
expectedFields: map[string]interface{}{
|
|
|
|
"messageHash": message.Envelope.Hash().String(),
|
|
|
|
"pubsubTopic": "",
|
|
|
|
"contentTopic": "0x12345679",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
runTestCase(t, tc)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestProcessMissedMessage(t *testing.T) {
|
|
|
|
now := time.Now()
|
|
|
|
message := common.NewReceivedMessage(
|
|
|
|
v2protocol.NewEnvelope(
|
|
|
|
&pb.WakuMessage{
|
|
|
|
Payload: []byte{1, 2, 3, 4, 5},
|
|
|
|
ContentTopic: testContentTopic,
|
|
|
|
Version: proto.Uint32(0),
|
|
|
|
Timestamp: proto.Int64(now.Unix()),
|
|
|
|
}, 0, ""),
|
|
|
|
common.MissingMessageType,
|
|
|
|
)
|
|
|
|
tc := testCase{
|
|
|
|
name: "MissedMessage",
|
|
|
|
input: MissedMessage{
|
|
|
|
Envelope: message.Envelope,
|
|
|
|
},
|
|
|
|
expectedType: MissedMessageMetric,
|
|
|
|
expectedFields: map[string]interface{}{
|
|
|
|
"messageHash": message.Envelope.Hash().String(),
|
|
|
|
"pubsubTopic": "",
|
|
|
|
"contentTopic": message.Envelope.Message().ContentTopic,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
runTestCase(t, tc)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestProcessDialFailure(t *testing.T) {
|
|
|
|
tc := testCase{
|
|
|
|
name: "DialFailure",
|
|
|
|
input: DialFailure{
|
|
|
|
ErrorType: common.ErrorUnknown,
|
|
|
|
ErrorMsg: "test error message",
|
|
|
|
Protocols: "test-protocols",
|
|
|
|
},
|
|
|
|
expectedType: DialFailureMetric,
|
|
|
|
expectedFields: map[string]interface{}{
|
|
|
|
"errorType": float64(common.ErrorUnknown),
|
|
|
|
"errorMsg": "test error message",
|
|
|
|
"protocols": "test-protocols",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
runTestCase(t, tc)
|
|
|
|
}
|