Skip to content

Commit

Permalink
Merge pull request #1116 from lightninglabs/maintenance
Browse files Browse the repository at this point in the history
Small fixes after recent PRs
  • Loading branch information
guggero authored Sep 5, 2024
2 parents 72551b4 + 6f4d65f commit 7177a5a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 18 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ env:
GOPATH: /home/runner/work/go

GO_VERSION: '1.22.3'

LITD_ITEST_BRANCH: '0-19-staging'

jobs:
#######################
Expand Down Expand Up @@ -306,7 +308,11 @@ jobs:
uses: ./.github/actions/setup-go

- name: Clone Lit repository
run: git clone https://github.com/lightninglabs/lightning-terminal.git
uses: actions/checkout@v3
with:
repository: lightninglabs/lightning-terminal
ref: ${{ env.LITD_ITEST_BRANCH }}
path: lightning-terminal

- name: Update go.mod to use the local Tap repository
working-directory: ./lightning-terminal
Expand All @@ -316,7 +322,7 @@ jobs:
- name: Install yarn
run: npm install -g yarn

- name: setup nodejs
uses: ./lightning-terminal/.github/actions/setup-node
with:
Expand Down
15 changes: 7 additions & 8 deletions itest/loadtest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,18 @@ type BitcoinConfig struct {

// PrometheusGatewayConfig defines exported config options for connecting to the
// Prometheus PushGateway.
//
//nolint:lll
type PrometheusGatewayConfig struct {
// nolint: lll
Enabled bool `long:"enabled" description:"Enable pushing metrics to Prometheus PushGateway"`
// nolint: lll
Enabled bool `long:"enabled" description:"Enable pushing metrics to Prometheus PushGateway"`
Host string `long:"host" description:"Prometheus PushGateway host address"`
Port int `long:"port" description:"Prometheus PushGateway port"`
PushURL string
}

// Config holds the main configuration for the performance testing binary.
//
//nolint:lll
type Config struct {
// TestCases is a comma separated list of test cases that will be
// executed.
Expand Down Expand Up @@ -111,8 +113,6 @@ type Config struct {

// PrometheusGateway is the configuration for the Prometheus
// PushGateway.
//
// nolint: lll
PrometheusGateway *PrometheusGatewayConfig `group:"prometheus-gateway" namespace:"prometheus-gateway" description:"Prometheus PushGateway configuration"`
}

Expand Down Expand Up @@ -185,9 +185,8 @@ func ValidateConfig(cfg Config) (*Config, error) {
gatewayPort := cfg.PrometheusGateway.Port

if gatewayHost == "" {
return nil, fmt.Errorf(
"gateway hostname may not be empty",
)
return nil, fmt.Errorf("gateway hostname may not be " +
"empty")
}

if gatewayPort == 0 {
Expand Down
20 changes: 12 additions & 8 deletions itest/loadtest/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ func TestPerformance(t *testing.T) {
t.Fatalf("test case %v failed", tc.name)
}

// Calculate the test duration and push metrics if the test case succeeded.
// Calculate the test duration and push metrics if the test case
// succeeded.
if cfg.PrometheusGateway.Enabled {
duration := time.Since(startTime).Seconds()

Expand All @@ -93,19 +94,22 @@ func TestPerformance(t *testing.T) {
// Update the metric with the test duration.
testDuration.WithLabelValues(label).Set(duration)

t.Logf("Pushing testDuration %v with label %v to gateway", duration, label)
t.Logf("Pushing testDuration %v with label %v to "+
"gateway", duration, label)

// Create a new pusher to push the metrics.
pusher := push.New(cfg.PrometheusGateway.PushURL, "load_test").
Collector(testDuration)
pusher := push.New(
cfg.PrometheusGateway.PushURL, "load_test",
).Collector(testDuration)

// Push the metrics to Prometheus PushGateway.
if err := pusher.Add(); err != nil {
t.Logf("Could not push metrics to Prometheus PushGateway: %v",
err)
t.Logf("Could not push metrics to Prometheus "+
"PushGateway: %v", err)
} else {
t.Logf("Metrics pushed for test case '%s': duration = %v seconds",
tc.name, duration)
t.Logf("Metrics pushed for test case '%s': "+
"duration = %v seconds", tc.name,
duration)
}
}
}
Expand Down

0 comments on commit 7177a5a

Please sign in to comment.