mirror of
https://github.com/ostreedev/ostree.git
synced 2024-12-23 21:35:26 +03:00
8057254b0b
We were considering using this for Docker integration, but we may end up going a different architectural path. Anyways, it doesn't hurt to have the bindings in here - they can do a few things. I decided to fork some of the core code from https://github.com/dradtke/gotk3 because...well, what we really need a GIR-based core generator but I didn't want to start on the fully correct thing until we knew we wanted it, and this was a quick hack. Also, let's make a `contrib/` directory for things like this.
56 lines
1.1 KiB
Go
56 lines
1.1 KiB
Go
// +build linux
|
|
|
|
// Public API specification for libostree Go bindings
|
|
|
|
package ostree
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestTypeName(t *testing.T) {
|
|
name := RepoGetType().Name();
|
|
if name != "OstreeRepo" {
|
|
t.Errorf("%s != OstreeRepo");
|
|
}
|
|
}
|
|
|
|
func TestRepoNew(t *testing.T) {
|
|
r, err := RepoNewOpen("/ostree/repo")
|
|
if err != nil {
|
|
t.Errorf("%s", err);
|
|
return
|
|
}
|
|
parent := r.GetParent()
|
|
if parent != nil {
|
|
t.Errorf("Expected no parent")
|
|
return
|
|
}
|
|
}
|
|
|
|
func TestRepoGetMetadataVersion(t *testing.T) {
|
|
r, err := RepoNewOpen("/ostree/repo")
|
|
if err != nil {
|
|
t.Errorf("%s", err);
|
|
return
|
|
}
|
|
commit,err := r.ResolveRev("rhel-atomic-host/7/x86_64/standard")
|
|
if err != nil {
|
|
t.Errorf("%s", err)
|
|
return
|
|
}
|
|
commitv,err := r.LoadVariant(OBJECT_TYPE_COMMIT, commit)
|
|
if err != nil {
|
|
t.Errorf("%s", err)
|
|
return
|
|
}
|
|
ver, err := commitv.CommitGetMetadataKeyString("version")
|
|
if err != nil {
|
|
t.Errorf("%s", err)
|
|
return
|
|
}
|
|
if ver != "7.1.3" {
|
|
t.Errorf("expected 7.1.3")
|
|
}
|
|
}
|