mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-11 03:11:50 +00:00
Add metrics endpoint with http metrics using Prometheus client lib
This commit is contained in:
committed by
Benj Fassbind
parent
8046fb1eb9
commit
6539e1b856
@@ -7,6 +7,7 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/user"
|
||||
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/console"
|
||||
@@ -120,8 +121,12 @@ func (s *DownloaderSuite) TestDownloadConnectError(c *C) {
|
||||
}
|
||||
|
||||
func skipIfRoot(c *C) {
|
||||
user := os.Getenv("USER")
|
||||
if user == "root" {
|
||||
currentUser, err := user.Current()
|
||||
if err != nil {
|
||||
c.Skip("Unknown user")
|
||||
}
|
||||
|
||||
if currentUser.Username == "root" {
|
||||
c.Skip("Root user")
|
||||
}
|
||||
}
|
||||
@@ -129,7 +134,7 @@ func skipIfRoot(c *C) {
|
||||
func (s *DownloaderSuite) TestDownloadFileError(c *C) {
|
||||
skipIfRoot(c)
|
||||
c.Assert(s.d.Download(s.ctx, s.url+"/test", "/"),
|
||||
ErrorMatches, ".*permission denied")
|
||||
ErrorMatches, ".*(permission denied|read-only file system)")
|
||||
}
|
||||
|
||||
func (s *DownloaderSuite) TestGetLength(c *C) {
|
||||
|
||||
@@ -114,7 +114,7 @@ func (s *GrabDownloaderSuite) TestDownloadConnectError(c *C) {
|
||||
func (s *GrabDownloaderSuite) TestDownloadFileError(c *C) {
|
||||
skipIfRoot(c)
|
||||
c.Assert(s.d.Download(s.ctx, s.url+"/test", "/"),
|
||||
ErrorMatches, ".*permission denied")
|
||||
ErrorMatches, ".*(permission denied|read-only file system)")
|
||||
}
|
||||
|
||||
func (s *GrabDownloaderSuite) TestGetLength(c *C) {
|
||||
|
||||
Reference in New Issue
Block a user