mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: don't activate alarm w/missing AlarmType
Narrowly prevent etcd from crashing when given a bad ACTIVATE payload, e.g.:
$ curl -d "{\"action\":\"ACTIVATE\"}" ${ETCD}/v3/maintenance/alarm
curl: (52) Empty reply from server
This commit is contained in:
@@ -366,6 +366,21 @@ func testV3CurlResignMissiongLeaderKey(cx ctlCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestV3CurlMaintenanceAlarmMissiongAlarm(t *testing.T) {
|
||||
for _, p := range apiPrefix {
|
||||
testCtl(t, testV3CurlMaintenanceAlarmMissiongAlarm, withApiPrefix(p), withCfg(*newConfigNoTLS()))
|
||||
}
|
||||
}
|
||||
|
||||
func testV3CurlMaintenanceAlarmMissiongAlarm(cx ctlCtx) {
|
||||
if err := cURLPost(cx.epc, cURLReq{
|
||||
endpoint: path.Join(cx.apiPrefix, "/maintenance/alarm"),
|
||||
value: `{"action": "ACTIVATE"}`,
|
||||
}); err != nil {
|
||||
cx.t.Fatalf("failed post maintenance alarm (%s) (%v)", cx.apiPrefix, err)
|
||||
}
|
||||
}
|
||||
|
||||
// to manually decode; JSON marshals integer fields with
|
||||
// string types, so can't unmarshal with epb.CampaignResponse
|
||||
type campaignResponse struct {
|
||||
|
||||
Reference in New Issue
Block a user