@@ -423,6 +423,7 @@ func (s *ClientSuite) TestUpdateRoots(c *C) {
423
423
expectedVersions map [string ]int
424
424
}{
425
425
<< << << < HEAD
426
+ << << << < HEAD
426
427
<< << << < HEAD
427
428
// Succeeds when there is no root update.
428
429
{"testdata/Published1Time" , nil , map [string ]int {"root" : 1 , "timestamp" : 1 , "snapshot" : 1 , "targets" : 1 }},
@@ -497,36 +498,34 @@ func (s *ClientSuite) TestUpdateRoots(c *C) {
497
498
// (10) Fails updating root to 2.root.json when the value of the version field inside it is 3 (rollforward attack prevention).
498
499
499
500
// Test (1)
501
+ == == == =
502
+ // Succeeds when there is no root update.
503
+ >> >> >> > 2 a38d97 (updating the comments based on the feedbacks .)
500
504
{"testdata/Published1Time" , nil , map [string ]int {"root" : 1 , "timestamp" : 1 , "snapshot" : 1 , "targets" : 1 }},
501
- // Test (2)
505
+ // Succeeds updating root from version 1 to version 2.
502
506
{"testdata / Published2Times_keyrotated ", nil , map [string ]int {"root" : 2 , "timestamp" : 1 , "snapshot" : 1 , "targets" : 1 }},
503
- // Test (3)
507
+ // Succeeds updating root from version 1 to version 2 when the client's initial root version is expired.
504
508
{"testdata / Published2Times_keyrotated_initialrootexpired ", nil , map [string ]int {"root" : 2 , "timestamp" : 1 , "snapshot" : 1 , "targets" : 1 }},
505
- // Test (4)
509
+ // Succeeds updating root from version 1 to version 3 when versions 1 and 2 are expired.
506
510
{"testdata / Published3Times_keyrotated_initialrootsexpired ", nil , map [string ]int {"root" : 3 , "timestamp" : 1 , "snapshot" : 1 , "targets" : 1 }},
507
- // Test(5)
511
+ // Succeeds updating root from version 2 to version 3.
508
512
{"testdata / Published3Times_keyrotated_initialrootsexpired_clientversionis2 ", nil , map [string ]int {"root" : 3 , "timestamp" : 1 , "snapshot" : 1 , "targets" : 1 }},
509
- // Test (6)
513
+ // Fails updating root from version 1 to version 3 when versions 1 and 3 are expired but version 2 is not expired.
510
514
{"testdata / Published3Times_keyrotated_latestrootexpired ", ErrDecodeFailed {File : "root.json" , Err : verify.ErrExpired {}}, map [string ]int {"root" : 2 , "timestamp" : 1 , "snapshot" : 1 , "targets" : 1 }},
511
- // Test (7)
515
+ // Fails updating root from version 1 to version 2 when old root 1 did not sign off on it (nth root didn't sign off n+1).
512
516
{"testdata / Published2Times_keyrotated_invalidOldRootSignature ", errors .New ("tuf: signature verification failed" ), map [string ]int {}},
513
- // Test (8 )
517
+ // Fails updating root from version 1 to version 2 when the new root 2 did not sign itself (n+1th root didn't sign off n+1 )
514
518
{"testdata / Published2Times_keyrotated_invalidNewRootSignature ", errors .New ("tuf: signature verification failed" ), map [string ]int {}},
515
- // Test (9)
519
+ // Fails updating root to 2.root.json when the value of the version field inside it is 1 (rollback attack prevention).
516
520
{"testdata / Published1Time_backwardRootVersion ", verify .ErrWrongVersion (verify.ErrWrongVersion {Given : 1 , Expected : 2 }), map [string ]int {}},
517
- // Test (10)
521
+ // Fails updating root to 2.root.json when the value of the version field inside it is 3 (rollforward attack prevention).
518
522
{"testdata / Published3Times_keyrotated_forwardRootVersion ", verify .ErrWrongVersion (verify.ErrWrongVersion {Given : 3 , Expected : 2 }), map [string ]int {}},
519
523
520
- // Test cases for checking the version of non-root metadata after their key is being rotated:
521
- // (i) snapshot role key rotation increase the snapshot and timestamp.
522
- // (ii) targets role key rotation increase the snapshot, timestamp, and targets.
523
- // (iii) timestamp role key rotation increase the timestamp.
524
-
525
- // Test (i)
524
+ // snapshot role key rotation increase the snapshot and timestamp.
526
525
{"testdata / Published2Times_snapshot_keyrotated ", nil , map [string ]int {"root" : 2 , "timestamp" : 2 , "snapshot" : 2 , "targets" : 1 }},
527
- // Test (ii)
526
+ // targets role key rotation increase the snapshot, timestamp, and targets.
528
527
{"testdata / Published2Times_targets_keyrotated ", nil , map [string ]int {"root" : 2 , "timestamp" : 2 , "snapshot" : 2 , "targets" : 2 }},
529
- // Test (iii)
528
+ // timestamp role key rotation increase the timestamp.
530
529
{"testdata / Published2Times_timestamp_keyrotated ", nil , map [string ]int {"root" : 2 , "timestamp" : 2 , "snapshot" : 1 , "targets" : 1 }},
531
530
>> >> >> > 68 a35d0 (update fixtures and clarify test comments .)
532
531
}
0 commit comments