MCPcopy Create free account
hub / github.com/cloudbase/garm / TestGetInstanceMetadata

Method TestGetInstanceMetadata

runner/metadata_test.go:621–645  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

619}
620
621func (s *MetadataTestSuite) TestGetInstanceMetadata() {
622 // Set up github tools cache for the entity
623 tools := []commonParams.RunnerApplicationDownload{
624 {
625 OS: garmTesting.Ptr("linux"),
626 Architecture: garmTesting.Ptr("x64"),
627 DownloadURL: garmTesting.Ptr("https://example.com/actions-runner-linux-x64-2.0.0.tar.gz"),
628 Filename: garmTesting.Ptr("actions-runner-linux-x64-2.0.0.tar.gz"),
629 SHA256Checksum: garmTesting.Ptr("abc123"),
630 },
631 }
632 cache.SetGithubToolsCache(s.Fixtures.TestEntity, tools)
633
634 metadata, err := s.Runner.GetInstanceMetadata(s.instanceCtx)
635
636 s.Require().Nil(err)
637 s.Require().NotEmpty(metadata.RunnerName)
638 s.Require().Equal(s.Fixtures.TestInstance.Name, metadata.RunnerName)
639 s.Require().Equal(params.GithubEndpointType, metadata.ForgeType)
640 s.Require().False(metadata.JITEnabled)
641 s.Require().False(metadata.AgentMode)
642 s.Require().NotNil(metadata.RunnerTools)
643 // Metadata access details are populated from instance
644 s.Require().NotNil(metadata.MetadataAccess)
645}
646
647func (s *MetadataTestSuite) TestGetInstanceMetadataUnauthorized() {
648 _, err := s.Runner.GetInstanceMetadata(s.unauthorizedCtx)

Callers

nothing calls this directly

Calls 2

SetGithubToolsCacheFunction · 0.92
GetInstanceMetadataMethod · 0.80

Tested by

no test coverage detected