MCPcopy Create free account
hub / github.com/bytebase/bytebase / TestPlanSpecAdd_EmitsIssueComment

Function TestPlanSpecAdd_EmitsIssueComment

backend/tests/plan_update_test.go:171–210  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

169}
170
171func TestPlanSpecAdd_EmitsIssueComment(t *testing.T) {
172 t.Parallel()
173 a := require.New(t)
174 f := setupPlanUpdateFixture(t, true)
175
176 originalSpec := f.plan.Specs[0]
177 newSpecID := uuid.NewString()
178 _, err := f.ctl.planServiceClient.UpdatePlan(f.ctx, connect.NewRequest(&v1pb.UpdatePlanRequest{
179 Plan: &v1pb.Plan{
180 Name: f.plan.Name,
181 Specs: []*v1pb.Plan_Spec{
182 originalSpec,
183 {
184 Id: newSpecID,
185 Config: &v1pb.Plan_Spec_ChangeDatabaseConfig{
186 ChangeDatabaseConfig: &v1pb.Plan_ChangeDatabaseConfig{
187 Targets: []string{f.database.Name},
188 Sheet: f.sheet2.Name,
189 },
190 },
191 },
192 },
193 },
194 UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"specs"}},
195 }))
196 a.NoError(err)
197
198 events := listPlanUpdateEvents(t, f)
199 a.Len(events, 1)
200 ev := events[0]
201 a.Len(ev.FromSpecs, 1)
202 a.Len(ev.ToSpecs, 2)
203 a.Equal(originalSpec.Id, ev.FromSpecs[0].Id)
204 idsAfter := map[string]bool{}
205 for _, s := range ev.ToSpecs {
206 idsAfter[s.Id] = true
207 }
208 a.True(idsAfter[originalSpec.Id])
209 a.True(idsAfter[newSpecID])
210}
211
212func TestPlanSpecRemove_EmitsIssueComment(t *testing.T) {
213 t.Parallel()

Callers

nothing calls this directly

Calls 5

setupPlanUpdateFixtureFunction · 0.85
listPlanUpdateEventsFunction · 0.85
LenMethod · 0.80
UpdatePlanMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected