MCPcopy Create free account
hub / github.com/aptly-dev/aptly / SetUpSuite

Method SetUpSuite

api/published_file_missing_test.go:42–85  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

40var _ = Suite(&PublishedFileMissingSuite{})
41
42func (s *PublishedFileMissingSuite) SetUpSuite(c *C) {
43 aptly.Version = "publishedFileMissingTest"
44
45 tempDir, err := os.MkdirTemp("", "aptly-published-missing-test")
46 c.Assert(err, IsNil)
47 s.tempDir = tempDir
48 s.poolPath = filepath.Join(tempDir, "pool")
49 s.publicPath = filepath.Join(tempDir, "public")
50
51 file, err := os.CreateTemp("", "aptly-published-missing-config")
52 c.Assert(err, IsNil)
53 s.configFile = file
54
55 config := gin.H{
56 "rootDir": tempDir,
57 "downloadDir": filepath.Join(tempDir, "download"),
58 "architectures": []string{"amd64"},
59 "dependencyFollowSuggests": false,
60 "dependencyFollowRecommends": false,
61 "gpgDisableSign": true,
62 "gpgDisableVerify": true,
63 "gpgProvider": "internal",
64 "skipLegacyPool": true,
65 "enableMetricsEndpoint": false,
66 }
67
68 jsonString, err := json.Marshal(config)
69 c.Assert(err, IsNil)
70 _, err = file.Write(jsonString)
71 c.Assert(err, IsNil)
72
73 flags := flag.NewFlagSet("publishedFileMissingTestFlags", flag.ContinueOnError)
74 flags.Bool("no-lock", true, "disable database locking for test")
75 flags.Int("db-open-attempts", 3, "dummy")
76 flags.String("config", s.configFile.Name(), "config file")
77 flags.String("architectures", "", "dummy")
78 s.flags = flags
79
80 context, err := ctx.NewContext(s.flags)
81 c.Assert(err, IsNil)
82
83 s.context = context
84 s.router = Router(context)
85}
86
87func (s *PublishedFileMissingSuite) TearDownSuite(c *C) {
88 if s.configFile != nil {

Callers

nothing calls this directly

Calls 3

RouterFunction · 0.85
WriteMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected