github.com/google/syzkaller@v0.0.0-20251211124644-a066d2bc4b02/syz-cluster/series-tracker/manifest_test.go (about)

     1  // Copyright 2024 syzkaller project authors. All rights reserved.
     2  // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  package main
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/stretchr/testify/assert"
    10  )
    11  
    12  func TestParseManifest(t *testing.T) {
    13  	info, err := ParseManifest("http://localhost", []byte(testManifest))
    14  	assert.NoError(t, err)
    15  	assert.Len(t, info, 2)
    16  	assert.Equal(t, 1, info["name"].Epochs)
    17  	second := info["name2"]
    18  	assert.Equal(t, 2, second.Epochs)
    19  	assert.Equal(t, "http://localhost/name2/git/1.git", second.EpochURL(1))
    20  }
    21  
    22  const testManifest = `{
    23    "/name2/git/1.git": {
    24      "modified": 1638806983,
    25      "owner": null,
    26      "reference": null,
    27      "description": "Another repo",
    28      "fingerprint": "788f666601f9641375e11e167b5e6b1eeb549cbb"
    29    },
    30    "/name/git/0.git": {
    31      "modified": 1638806983,
    32      "owner": null,
    33      "reference": null,
    34      "description": "Some repo",
    35      "fingerprint": "788f666601f9641375e11e167b5e6b1eeb549cbb"
    36    },
    37    "/name2/git/0.git": {
    38      "modified": 1638806983,
    39      "owner": null,
    40      "reference": null,
    41      "description": "Another repo",
    42      "fingerprint": "788f666601f9641375e11e167b5e6b1eeb549cbb"
    43    }
    44  }`