~rogpeppe/juju-core/256-more-status

« back to all changes in this revision

Viewing changes to store/server_test.go

  • Committer: Gustavo Niemeyer
  • Date: 2013-03-20 14:05:13 UTC
  • mfrom: (1002.4.5 store-stats-start)
  • Revision ID: gustavo@niemeyer.net-20130320140513-z22s9o6tgd010hdx
store: support querying stats before/after a date

R=dimitern, jameinel
CC=
https://codereview.appspot.com/7653045

Show diffs side-by-side

added added

removed removed

Lines of Context:
325
325
                        store.CounterRequest{
326
326
                                Key:    []string{"a"},
327
327
                                Prefix: true,
 
328
                                List:   false,
 
329
                                By:     store.ByDay,
 
330
                                Start:  time.Date(2012, 5, 2, 0, 0, 0, 0, time.UTC),
 
331
                        },
 
332
                        "",
 
333
                        "2012-05-03  1\n2012-05-09  3\n",
 
334
                }, {
 
335
                        store.CounterRequest{
 
336
                                Key:    []string{"a"},
 
337
                                Prefix: true,
 
338
                                List:   false,
 
339
                                By:     store.ByDay,
 
340
                                Stop:   time.Date(2012, 5, 4, 0, 0, 0, 0, time.UTC),
 
341
                        },
 
342
                        "",
 
343
                        "2012-05-01  2\n2012-05-03  1\n",
 
344
                }, {
 
345
                        store.CounterRequest{
 
346
                                Key:    []string{"a"},
 
347
                                Prefix: true,
 
348
                                List:   false,
 
349
                                By:     store.ByDay,
 
350
                                Start:  time.Date(2012, 5, 3, 0, 0, 0, 0, time.UTC),
 
351
                                Stop:   time.Date(2012, 5, 3, 0, 0, 0, 0, time.UTC),
 
352
                        },
 
353
                        "",
 
354
                        "2012-05-03  1\n",
 
355
                }, {
 
356
                        store.CounterRequest{
 
357
                                Key:    []string{"a"},
 
358
                                Prefix: true,
328
359
                                List:   true,
329
360
                                By:     store.ByDay,
330
361
                        },
383
414
                if test.format != "" {
384
415
                        req.Form.Set("format", test.format)
385
416
                }
 
417
                if !test.request.Start.IsZero() {
 
418
                        req.Form.Set("start", test.request.Start.Format("2006-01-02"))
 
419
                }
 
420
                if !test.request.Stop.IsZero() {
 
421
                        req.Form.Set("stop", test.request.Stop.Format("2006-01-02"))
 
422
                }
386
423
                switch test.request.By {
387
424
                case store.ByDay:
388
425
                        req.Form.Set("by", "day")