Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1493)

Side by Side Diff: tokenserver/appengine/impl/machinetoken/bigquery_log_test.go

Issue 2943403003: token-server: Fix panic when generating machine token for unrecognized machine. (Closed)
Patch Set: flatten Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The LUCI Authors. All rights reserved. 1 // Copyright 2017 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package machinetoken 5 package machinetoken
6 6
7 import ( 7 import (
8 "net" 8 "net"
9 "testing" 9 "testing"
10 "time" 10 "time"
11 11
12 "github.com/luci/luci-go/common/clock" 12 "github.com/luci/luci-go/common/clock"
13 "github.com/luci/luci-go/common/proto/google" 13 "github.com/luci/luci-go/common/proto/google"
14 "github.com/luci/luci-go/tokenserver/api" 14 "github.com/luci/luci-go/tokenserver/api"
15 "github.com/luci/luci-go/tokenserver/api/minter/v1" 15 "github.com/luci/luci-go/tokenserver/api/minter/v1"
16 16
17 . "github.com/smartystreets/goconvey/convey" 17 . "github.com/smartystreets/goconvey/convey"
18 ) 18 )
19 19
20 func TestMintedTokenInfo(t *testing.T) { 20 func TestMintedTokenInfo(t *testing.T) {
21 Convey("produces correct row map", t, func() { 21 Convey("produces correct row map", t, func() {
22 » » ctx := testingContext() 22 » » ctx := testingContext(testingCA)
smut 2017/06/20 22:37:17 Where is testingCA defined?
23 23
24 info := MintedTokenInfo{ 24 info := MintedTokenInfo{
25 Request: testingRawRequest(ctx), 25 Request: testingRawRequest(ctx),
26 Response: &minter.MachineTokenResponse{ 26 Response: &minter.MachineTokenResponse{
27 ServiceVersion: "unit-tests/mocked-ver", 27 ServiceVersion: "unit-tests/mocked-ver",
28 TokenType: &minter.MachineTokenResponse_LuciMach ineToken{ 28 TokenType: &minter.MachineTokenResponse_LuciMach ineToken{
29 LuciMachineToken: &minter.LuciMachineTok en{ 29 LuciMachineToken: &minter.LuciMachineTok en{
30 MachineToken: "zzzz", 30 MachineToken: "zzzz",
31 Expiry: google.NewTimestam p(clock.Now(ctx).Add(time.Hour)), 31 Expiry: google.NewTimestam p(clock.Now(ctx).Add(time.Hour)),
32 }, 32 },
(...skipping 21 matching lines...) Expand all
54 "gae_request_id": "gae-request-id", 54 "gae_request_id": "gae-request-id",
55 "issued_at": 1.422936306e+09, 55 "issued_at": 1.422936306e+09,
56 "machine_fqdn": "luci-token-server-test-1.fake.do main", 56 "machine_fqdn": "luci-token-server-test-1.fake.do main",
57 "peer_ip": "127.10.10.10", 57 "peer_ip": "127.10.10.10",
58 "service_version": "unit-tests/mocked-ver", 58 "service_version": "unit-tests/mocked-ver",
59 "signature_algorithm": "SHA256_RSA_ALGO", 59 "signature_algorithm": "SHA256_RSA_ALGO",
60 "token_type": "LUCI_MACHINE_TOKEN", 60 "token_type": "LUCI_MACHINE_TOKEN",
61 }) 61 })
62 }) 62 })
63 } 63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698