Provisioning: Add refs endpoint (#108014)
This commit is contained in:
@@ -83,6 +83,36 @@ func TestIntegrationProvisioning_CreatingAndGetting(t *testing.T) {
|
||||
Suffix("files/").
|
||||
Do(context.Background())
|
||||
require.NoError(t, rsp.Error())
|
||||
|
||||
// Verify that we can list refs
|
||||
rsp = helper.AdminREST.Get().
|
||||
Namespace("default").
|
||||
Resource("repositories").
|
||||
Name(name).
|
||||
Suffix("refs").
|
||||
Do(context.Background())
|
||||
|
||||
if expectedRepo.Spec.Type == provisioning.LocalRepositoryType {
|
||||
require.ErrorContains(t, rsp.Error(), "does not support versioned operations")
|
||||
} else {
|
||||
require.NoError(t, rsp.Error())
|
||||
refs := &provisioning.RefList{}
|
||||
err = rsp.Into(refs)
|
||||
require.NoError(t, err)
|
||||
require.True(t, len(refs.Items) >= 1, "should have at least one ref")
|
||||
|
||||
var foundBranch bool
|
||||
for _, ref := range refs.Items {
|
||||
// FIXME: this assertion should be improved for all git types and take things from config
|
||||
if ref.Name == "integration-test" {
|
||||
require.Equal(t, "0f3370c212b04b9704e00f6926ef339bf91c7a1b", ref.Hash)
|
||||
require.Equal(t, "https://github.com/grafana/grafana-git-sync-demo/tree/integration-test", ref.RefURL)
|
||||
foundBranch = true
|
||||
}
|
||||
}
|
||||
|
||||
require.True(t, foundBranch, "branch should be found")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user