feat: include facts when listing entities

This commit is contained in:
Jefferson Girão
2020-02-07 09:44:42 +01:00
parent 33f6444366
commit feba36e239
8 changed files with 132 additions and 129 deletions
+19 -9
View File
@@ -22,9 +22,17 @@ func (s *Server) ListEntities(ctx context.Context, req *pb.ListEntitiesRequest)
return nil, status.Error(codes.Internal, "could not list entities")
}
var result []*pb.Entity
for _, v := range entities {
result = append(result, &pb.Entity{Uri: v})
var result []*pb.GetEntityReply
for _, entity := range entities {
var facts []*pb.Fact
factTuples, err := s.Storage.GetFacts(entity)
if err != nil {
return nil, status.Error(codes.Internal, fmt.Sprintf("could not get facts for %v", entity))
}
for key, value := range factTuples {
facts = append(facts, &pb.Fact{Name: key, Value: value})
}
result = append(result, &pb.GetEntityReply{Entity: &pb.Entity{Uri: entity}, Facts: facts})
}
return &pb.ListEntitiesReply{Entities: result}, nil
@@ -41,18 +49,20 @@ func (s *Server) CreateEntity(ctx context.Context, req *pb.CreateEntityRequest)
// GetEntity returns an inventory Entity with the selected facts
func (s *Server) GetEntity(ctx context.Context, req *pb.GetEntityRequest) (*pb.GetEntityReply, error) {
var facts []*pb.Fact
entityUri, err := s.Storage.GetEntity(req.GetEntity().GetUri())
if err != nil {
return nil, status.Error(codes.Internal, fmt.Sprintf("could not get entity %v", err))
}
for _, factName := range req.GetIncludeFacts() {
value, err := s.Storage.GetFact(entityUri, factName)
if err != nil {
return nil, status.Error(codes.Internal, fmt.Sprintf("could not get fact %v for %v", factName, entityUri))
}
facts = append(facts, &pb.Fact{Name: factName, Value: value})
factTuples, err := s.Storage.GetFacts(entityUri)
if err != nil {
return nil, status.Error(codes.Internal, fmt.Sprintf("could not get facts for %v", entityUri))
}
for key, value := range factTuples {
facts = append(facts, &pb.Fact{Name: key, Value: value})
}
return &pb.GetEntityReply{Entity: &pb.Entity{Uri: entityUri}, Facts: facts}, nil
}
+37 -69
View File
@@ -15,86 +15,65 @@ import (
var entityURI = "boss://test/test"
func TestServerListEntities(t *testing.T) {
func TestServer(t *testing.T) {
testStorage := NewTestStorage()
defer testStorage.Close()
s := Server{Storage: testStorage.Storage}
entity := &pb.Entity{Uri: entityURI}
t.Run("Listing Entities matching prefix", func(t *testing.T) {
entity := &pb.Entity{Uri: entityURI}
_, err := s.CreateEntity(context.Background(), &pb.CreateEntityRequest{Entity: entity})
if err != nil {
t.Errorf("ServerTest(TestServerListEntities) could not create: %v", err)
}
s.CreateEntity(context.Background(), &pb.CreateEntityRequest{Entity: entity})
setFactReq := &pb.SetFactRequest{EntityUri: entityURI, Name: "test-name", Value: "test-value"}
s.SetFact(context.Background(), setFactReq)
list, err := s.ListEntities(context.Background(), &pb.ListEntitiesRequest{UriPrefix: ""})
if err != nil {
t.Errorf("ServerTest(TestServerListEntities) could not list: %v", err)
}
if len(list.GetEntities()) != 1 {
t.Errorf("ServerTest(TestServerListEntities) expected %v items, got %v", 1, len(list.GetEntities()))
}
if list.GetEntities()[0].GetUri() != entityURI {
t.Errorf("ServerTest(TestServerListEntities) expected uri %v, got %v", "boss://test/test", list.GetEntities()[0].GetUri())
}
list, err := s.ListEntities(context.Background(), &pb.ListEntitiesRequest{UriPrefix: ""})
if err != nil {
t.Errorf("ServerTest(ListEntities) could not list: %v", err)
}
if len(list.GetEntities()) != 1 {
t.Errorf("ServerTest(ListEntities) expected %v items, got %v", 1, len(list.GetEntities()))
}
if list.GetEntities()[0].GetEntity().GetUri() != entityURI {
t.Errorf("ServerTest(ListEntities) expected uri %v, got %v", "boss://test/test", list.GetEntities()[0].GetEntity().GetUri())
}
expectedFacts := []*pb.Fact{{Name: "test-name", Value: "test-value"}}
if !reflect.DeepEqual(list.GetEntities()[0].GetFacts(), expectedFacts) {
t.Errorf("ServerTest(ListEntities) got %v, wanted %v", list.GetEntities()[0].GetFacts(), expectedFacts)
}
})
list, err = s.ListEntities(context.Background(), &pb.ListEntitiesRequest{UriPrefix: "boss://test2"})
if err != nil {
t.Errorf("ServerTest(TestServerListEntities) could not list: %v", err)
}
if len(list.GetEntities()) != 0 {
t.Errorf("ServerTest(TestServerListEntities) expected %v items, got %v", 0, len(list.GetEntities()))
}
}
t.Run("Listing Entities not matching prefix", func(t *testing.T) {
entity := &pb.Entity{Uri: entityURI}
func TestServerCreateEntity(t *testing.T) {
testStorage := NewTestStorage()
defer testStorage.Close()
s := Server{Storage: testStorage.Storage}
entity := &pb.Entity{Uri: entityURI}
createReq := &pb.CreateEntityRequest{Entity: entity}
resp, err := s.CreateEntity(context.Background(), createReq)
if err != nil {
t.Errorf("ServerTest(CreateEntity) got unexpected error %v", err)
}
if resp.GetEntity().GetUri() != entity.GetUri() {
t.Errorf("ServerTest(CreateEntity) expected %v, but got %v", entity.GetUri(), resp.GetEntity().GetUri())
}
}
func TestServerGetEntity(t *testing.T) {
t.Run("Get entity", func(t *testing.T) {
testStorage := NewTestStorage()
defer testStorage.Close()
s := Server{Storage: testStorage.Storage}
s.CreateEntity(context.Background(), &pb.CreateEntityRequest{Entity: entity})
list, err := s.ListEntities(context.Background(), &pb.ListEntitiesRequest{UriPrefix: "boss://test2"})
if err != nil {
t.Errorf("ServerTest(TestServerListEntities) could not list: %v", err)
}
if len(list.GetEntities()) != 0 {
t.Errorf("ServerTest(TestServerListEntities) expected %v items, got %v", 0, len(list.GetEntities()))
}
})
t.Run("Creating entity", func(t *testing.T) {
entity := &pb.Entity{Uri: entityURI}
createReq := &pb.CreateEntityRequest{Entity: entity}
s.CreateEntity(context.Background(), createReq)
req := &pb.GetEntityRequest{Entity: entity}
resp, err := s.GetEntity(context.Background(), req)
resp, err := s.CreateEntity(context.Background(), createReq)
if err != nil {
t.Errorf("ServerTest(GetEntity) got unexpected error %v", err)
}
if resp == nil {
t.Errorf("ServerTest(GetEntity) returned nil")
t.Errorf("ServerTest(CreateEntity) got unexpected error %v", err)
}
if resp.GetEntity().GetUri() != entity.GetUri() {
t.Errorf("ServerTest(GetEntity) got %v, wanted %v", resp.GetEntity().GetUri(), entity.GetUri())
t.Errorf("ServerTest(CreateEntity) expected %v, but got %v", entity.GetUri(), resp.GetEntity().GetUri())
}
})
t.Run("Get entity with included facts", func(t *testing.T) {
testStorage := NewTestStorage()
defer testStorage.Close()
s := Server{Storage: testStorage.Storage}
setFactReq := &pb.SetFactRequest{EntityUri: entityURI, Name: "test-name", Value: "test-value"}
s.SetFact(context.Background(), setFactReq)
entity := &pb.Entity{Uri: entityURI}
req := &pb.GetEntityRequest{Entity: entity, IncludeFacts: []string{"test-name"}}
req := &pb.GetEntityRequest{Entity: entity}
resp, err := s.GetEntity(context.Background(), req)
if err != nil {
@@ -108,14 +87,7 @@ func TestServerGetEntity(t *testing.T) {
t.Errorf("ServerTest(GetEntity) got %v, wanted %v", resp.GetFacts(), expectedFacts)
}
})
}
func TestServerSetFactForExistingEntity(t *testing.T) {
t.Run("Set fact for existing entity", func(t *testing.T) {
testStorage := NewTestStorage()
defer testStorage.Close()
s := Server{Storage: testStorage.Storage}
entity := &pb.Entity{Uri: entityURI}
createReq := &pb.CreateEntityRequest{Entity: entity}
s.CreateEntity(context.Background(), createReq)
@@ -134,10 +106,6 @@ func TestServerSetFactForExistingEntity(t *testing.T) {
})
t.Run("Set fact for non-existing entity", func(t *testing.T) {
testStorage := NewTestStorage()
defer testStorage.Close()
s := Server{Storage: testStorage.Storage}
req := &pb.SetFactRequest{EntityUri: entityURI, Name: "test-name", Value: "test-value"}
resp, err := s.SetFact(context.Background(), req)
if err != nil {
+3
View File
@@ -8,5 +8,8 @@ require (
github.com/golang/protobuf v1.3.3
github.com/spotify/backstage/proto v0.0.0-00010101000000-000000000000
go.etcd.io/bbolt v1.3.3
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 // indirect
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 // indirect
google.golang.org/grpc v1.27.0
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc // indirect
)
+22
View File
@@ -121,3 +121,25 @@ func (s *Storage) GetEntity(entityUri string) (string, error) {
return entityUri, nil
}
func (s *Storage) GetFacts(entityUri string) (map[string]string, error) {
facts := make(map[string]string)
err := s.db.View(func(tx *bbolt.Tx) error {
entityBucket := tx.Bucket([]byte(entityUri))
if entityBucket == nil {
return fmt.Errorf("bucket '%s' does not exist", entityUri)
}
c := entityBucket.Cursor()
for k, v := c.First(); k != nil; k, v = c.Next() {
facts[string(k)] = string(v)
}
return nil
})
if err != nil {
return nil, err
}
return facts, nil
}
+34 -34
View File
@@ -64,10 +64,10 @@ func (m *ListEntitiesRequest) GetUriPrefix() string {
}
type ListEntitiesReply struct {
Entities []*Entity `protobuf:"bytes,1,rep,name=entities,proto3" json:"entities,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Entities []*GetEntityReply `protobuf:"bytes,1,rep,name=entities,proto3" json:"entities,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListEntitiesReply) Reset() { *m = ListEntitiesReply{} }
@@ -95,7 +95,7 @@ func (m *ListEntitiesReply) XXX_DiscardUnknown() {
var xxx_messageInfo_ListEntitiesReply proto.InternalMessageInfo
func (m *ListEntitiesReply) GetEntities() []*Entity {
func (m *ListEntitiesReply) GetEntities() []*GetEntityReply {
if m != nil {
return m.Entities
}
@@ -558,36 +558,36 @@ func init() {
func init() { proto.RegisterFile("inventory/v1/inventory.proto", fileDescriptor_70be9028e322f9d8) }
var fileDescriptor_70be9028e322f9d8 = []byte{
// 457 bytes of a gzipped FileDescriptorProto
// 459 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x8f, 0x93, 0x40,
0x14, 0x0e, 0x85, 0xad, 0xf2, 0xca, 0x6e, 0x76, 0x67, 0x3d, 0x10, 0xb2, 0x31, 0xcd, 0x68, 0x4c,
0x0f, 0x86, 0x5d, 0xda, 0x8b, 0xf1, 0xe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0xd3, 0x87, 0x6e,
0xee, 0x21, 0xba, 0x06, 0x35, 0x91, 0xfc, 0xfc, 0x13, 0x8f, 0x40, 0xe3, 0x37, 0xa5, 0x02, 0xe5,
0x90, 0x4b, 0x9d, 0x8a, 0x4b, 0xce, 0x5f, 0x0d, 0xf4, 0x8f, 0x7b, 0x26, 0x94, 0x42, 0xaf, 0xba,
0xa2, 0x68, 0xdc, 0xa4, 0xeb, 0xc0, 0x2b, 0xd0, 0xb7, 0xdb, 0x81, 0xb8, 0x1b, 0x5b, 0xd0, 0xe5,
0xfe, 0xa0, 0x51, 0x8b, 0x07, 0x20, 0x67, 0x6c, 0xf9, 0x64, 0xf0, 0x36, 0xab, 0x93, 0xdc, 0xdc,
0xe6, 0x81, 0x75, 0x6a, 0x6e, 0xf3, 0xff, 0x65, 0x59, 0xc3, 0xa3, 0x62, 0x24, 0x51, 0xa3, 0xe4,
0xfa, 0x56, 0xf4, 0x5f, 0x1e, 0x7d, 0xbf, 0x20, 0x72, 0x8f, 0x25, 0x72, 0x5b, 0x12, 0x55, 0xc7,
0x78, 0x72, 0xf9, 0xcd, 0x90, 0xc9, 0xd4, 0x5e, 0x74, 0xc5, 0xdf, 0xc7, 0xf8, 0x5f, 0x00, 0x00,
0x00, 0xff, 0xff, 0x4c, 0xd9, 0x78, 0x44, 0x5e, 0x06, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -19,10 +19,10 @@ export namespace ListEntitiesRequest {
}
export class ListEntitiesReply extends jspb.Message {
getEntitiesList(): Array<Entity>;
setEntitiesList(value: Array<Entity>): void;
getEntitiesList(): Array<GetEntityReply>;
setEntitiesList(value: Array<GetEntityReply>): void;
clearEntitiesList(): void;
addEntities(value?: Entity, index?: number): Entity;
addEntities(value?: GetEntityReply, index?: number): GetEntityReply;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ListEntitiesReply.AsObject;
@@ -34,7 +34,7 @@ export class ListEntitiesReply extends jspb.Message {
export namespace ListEntitiesReply {
export type AsObject = {
entitiesList: Array<Entity.AsObject>,
entitiesList: Array<GetEntityReply.AsObject>,
}
}
@@ -442,7 +442,7 @@ proto.spotify.backstage.inventory.v1.ListEntitiesReply.prototype.toObject = func
proto.spotify.backstage.inventory.v1.ListEntitiesReply.toObject = function(includeInstance, msg) {
var f, obj = {
entitiesList: jspb.Message.toObjectList(msg.getEntitiesList(),
proto.spotify.backstage.inventory.v1.Entity.toObject, includeInstance)
proto.spotify.backstage.inventory.v1.GetEntityReply.toObject, includeInstance)
};
if (includeInstance) {
@@ -480,8 +480,8 @@ proto.spotify.backstage.inventory.v1.ListEntitiesReply.deserializeBinaryFromRead
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.spotify.backstage.inventory.v1.Entity;
reader.readMessage(value,proto.spotify.backstage.inventory.v1.Entity.deserializeBinaryFromReader);
var value = new proto.spotify.backstage.inventory.v1.GetEntityReply;
reader.readMessage(value,proto.spotify.backstage.inventory.v1.GetEntityReply.deserializeBinaryFromReader);
msg.addEntities(value);
break;
default:
@@ -518,35 +518,35 @@ proto.spotify.backstage.inventory.v1.ListEntitiesReply.serializeBinaryToWriter =
writer.writeRepeatedMessage(
1,
f,
proto.spotify.backstage.inventory.v1.Entity.serializeBinaryToWriter
proto.spotify.backstage.inventory.v1.GetEntityReply.serializeBinaryToWriter
);
}
};
/**
* repeated Entity entities = 1;
* @return {!Array<!proto.spotify.backstage.inventory.v1.Entity>}
* repeated GetEntityReply entities = 1;
* @return {!Array<!proto.spotify.backstage.inventory.v1.GetEntityReply>}
*/
proto.spotify.backstage.inventory.v1.ListEntitiesReply.prototype.getEntitiesList = function() {
return /** @type{!Array<!proto.spotify.backstage.inventory.v1.Entity>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.spotify.backstage.inventory.v1.Entity, 1));
return /** @type{!Array<!proto.spotify.backstage.inventory.v1.GetEntityReply>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.spotify.backstage.inventory.v1.GetEntityReply, 1));
};
/** @param {!Array<!proto.spotify.backstage.inventory.v1.Entity>} value */
/** @param {!Array<!proto.spotify.backstage.inventory.v1.GetEntityReply>} value */
proto.spotify.backstage.inventory.v1.ListEntitiesReply.prototype.setEntitiesList = function(value) {
jspb.Message.setRepeatedWrapperField(this, 1, value);
};
/**
* @param {!proto.spotify.backstage.inventory.v1.Entity=} opt_value
* @param {!proto.spotify.backstage.inventory.v1.GetEntityReply=} opt_value
* @param {number=} opt_index
* @return {!proto.spotify.backstage.inventory.v1.Entity}
* @return {!proto.spotify.backstage.inventory.v1.GetEntityReply}
*/
proto.spotify.backstage.inventory.v1.ListEntitiesReply.prototype.addEntities = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.spotify.backstage.inventory.v1.Entity, opt_index);
return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.spotify.backstage.inventory.v1.GetEntityReply, opt_index);
};
+1 -1
View File
@@ -17,7 +17,7 @@ message ListEntitiesRequest {
}
message ListEntitiesReply {
repeated Entity entities = 1;
repeated GetEntityReply entities = 1;
}
message GetEntityRequest {