• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mendersoftware / mender-server / 1978132441

11 Aug 2025 03:08PM UTC coverage: 65.376% (-0.1%) from 65.495%
1978132441

Pull #854

gitlab-ci

bahaa-ghazal
feat(workflows): Add CLI flag to migrate consumers from push to pull mode

Signed-off-by: Bahaa Aldeen Ghazal <bahaa.ghazal@northern.tech>
Pull Request #854: MEN-8326: Migrate consumers from push to pull mode

71 of 160 new or added lines in 5 files covered. (44.38%)

31 existing lines in 3 files now uncovered.

32338 of 49465 relevant lines covered (65.38%)

1.39 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/backend/services/workflows/client/nats/mocks/Client.go
1
// Copyright 2023 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14

15
// Code generated by mockery v2.45.1. DO NOT EDIT.
16

17
package mocks
18

19
import (
20
        context "context"
21

22
        nats "github.com/mendersoftware/mender-server/services/workflows/client/nats"
23
        nats_go "github.com/nats-io/nats.go"
24
        mock "github.com/stretchr/testify/mock"
25
)
26

27
// Client is an autogenerated mock type for the Client type
28
type Client struct {
29
        mock.Mock
30
}
31

32
// Close provides a mock function with given fields:
33
func (_m *Client) Close() {
×
34
        _m.Called()
×
35
}
×
36

37
// CreateConsumer provides a mock function with given fields: name, upsert, config
38
func (_m *Client) CreateConsumer(name string, upsert bool, config nats.ConsumerConfig) error {
×
39
        ret := _m.Called(name, upsert, config)
×
40

×
41
        if len(ret) == 0 {
×
42
                panic("no return value specified for CreateConsumer")
×
43
        }
44

45
        var r0 error
×
46
        if rf, ok := ret.Get(0).(func(string, bool, nats.ConsumerConfig) error); ok {
×
47
                r0 = rf(name, upsert, config)
×
48
        } else {
×
49
                r0 = ret.Error(0)
×
50
        }
×
51

52
        return r0
×
53
}
54

55
// DeleteConsumerByMode provides a mock function with given fields: name, mode
NEW
56
func (_m *Client) DeleteConsumerByMode(name string, mode nats.ConsumerMode) error {
×
NEW
57
        ret := _m.Called(name, mode)
×
NEW
58

×
NEW
59
        if len(ret) == 0 {
×
NEW
60
                panic("no return value specified for DeleteConsumerByMode")
×
61
        }
62

NEW
63
        var r0 error
×
NEW
64
        if rf, ok := ret.Get(0).(func(string, nats.ConsumerMode) error); ok {
×
NEW
65
                r0 = rf(name, mode)
×
NEW
66
        } else {
×
NEW
67
                r0 = ret.Error(0)
×
NEW
68
        }
×
69

NEW
70
        return r0
×
71
}
72

73
// GetConsumerConfig provides a mock function with given fields: name
74
func (_m *Client) GetConsumerConfig(name string) (*nats.ConsumerConfig, error) {
×
75
        ret := _m.Called(name)
×
76

×
77
        if len(ret) == 0 {
×
78
                panic("no return value specified for GetConsumerConfig")
×
79
        }
80

81
        var r0 *nats.ConsumerConfig
×
82
        var r1 error
×
83
        if rf, ok := ret.Get(0).(func(string) (*nats.ConsumerConfig, error)); ok {
×
84
                return rf(name)
×
85
        }
×
86
        if rf, ok := ret.Get(0).(func(string) *nats.ConsumerConfig); ok {
×
87
                r0 = rf(name)
×
88
        } else {
×
89
                if ret.Get(0) != nil {
×
90
                        r0 = ret.Get(0).(*nats.ConsumerConfig)
×
91
                }
×
92
        }
93

94
        if rf, ok := ret.Get(1).(func(string) error); ok {
×
95
                r1 = rf(name)
×
96
        } else {
×
97
                r1 = ret.Error(1)
×
98
        }
×
99

100
        return r0, r1
×
101
}
102

103
// IsConnected provides a mock function with given fields:
104
func (_m *Client) IsConnected() bool {
×
105
        ret := _m.Called()
×
106

×
107
        if len(ret) == 0 {
×
108
                panic("no return value specified for IsConnected")
×
109
        }
110

111
        var r0 bool
×
112
        if rf, ok := ret.Get(0).(func() bool); ok {
×
113
                r0 = rf()
×
114
        } else {
×
115
                r0 = ret.Get(0).(bool)
×
116
        }
×
117

118
        return r0
×
119
}
120

121
// JetStreamCreateStream provides a mock function with given fields: streamName
122
func (_m *Client) JetStreamCreateStream(streamName string) error {
×
123
        ret := _m.Called(streamName)
×
124

×
125
        if len(ret) == 0 {
×
126
                panic("no return value specified for JetStreamCreateStream")
×
127
        }
128

129
        var r0 error
×
130
        if rf, ok := ret.Get(0).(func(string) error); ok {
×
131
                r0 = rf(streamName)
×
132
        } else {
×
133
                r0 = ret.Error(0)
×
134
        }
×
135

136
        return r0
×
137
}
138

139
// JetStreamPublish provides a mock function with given fields: _a0, _a1
140
func (_m *Client) JetStreamPublish(_a0 string, _a1 []byte) error {
×
141
        ret := _m.Called(_a0, _a1)
×
142

×
143
        if len(ret) == 0 {
×
144
                panic("no return value specified for JetStreamPublish")
×
145
        }
146

147
        var r0 error
×
148
        if rf, ok := ret.Get(0).(func(string, []byte) error); ok {
×
149
                r0 = rf(_a0, _a1)
×
150
        } else {
×
151
                r0 = ret.Error(0)
×
152
        }
×
153

154
        return r0
×
155
}
156

157
// JetStreamSubscribe provides a mock function with given fields: ctx, subj, durable, q
NEW
158
func (_m *Client) JetStreamSubscribe(ctx context.Context, subj string, durable string, q chan *nats_go.Msg) (*nats_go.Subscription, error) {
×
159
        ret := _m.Called(ctx, subj, durable, q)
×
160

×
161
        if len(ret) == 0 {
×
162
                panic("no return value specified for JetStreamSubscribe")
×
163
        }
164

NEW
165
        var r0 *nats_go.Subscription
×
166
        var r1 error
×
NEW
167
        if rf, ok := ret.Get(0).(func(context.Context, string, string, chan *nats_go.Msg) (*nats_go.Subscription, error)); ok {
×
168
                return rf(ctx, subj, durable, q)
×
169
        }
×
NEW
170
        if rf, ok := ret.Get(0).(func(context.Context, string, string, chan *nats_go.Msg) *nats_go.Subscription); ok {
×
171
                r0 = rf(ctx, subj, durable, q)
×
172
        } else {
×
173
                if ret.Get(0) != nil {
×
NEW
174
                        r0 = ret.Get(0).(*nats_go.Subscription)
×
175
                }
×
176
        }
177

178
        if rf, ok := ret.Get(1).(func(context.Context, string, string, chan *nats_go.Msg) error); ok {
×
179
                r1 = rf(ctx, subj, durable, q)
×
180
        } else {
×
181
                r1 = ret.Error(1)
×
182
        }
×
183

184
        return r0, r1
×
185
}
186

187
// StreamName provides a mock function with given fields:
188
func (_m *Client) StreamName() string {
×
189
        ret := _m.Called()
×
190

×
191
        if len(ret) == 0 {
×
192
                panic("no return value specified for StreamName")
×
193
        }
194

195
        var r0 string
×
196
        if rf, ok := ret.Get(0).(func() string); ok {
×
197
                r0 = rf()
×
198
        } else {
×
199
                r0 = ret.Get(0).(string)
×
200
        }
×
201

202
        return r0
×
203
}
204

205
// NewClient creates a new instance of Client. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
206
// The first argument is typically a *testing.T value.
207
func NewClient(t interface {
208
        mock.TestingT
209
        Cleanup(func())
210
}) *Client {
×
211
        mock := &Client{}
×
212
        mock.Mock.Test(t)
×
213

×
214
        t.Cleanup(func() { mock.AssertExpectations(t) })
×
215

216
        return mock
×
217
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc