Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ require (
github.com/google/go-cmp v0.7.0
github.com/google/uuid v1.6.0
github.com/machinebox/graphql v0.2.2
github.com/sgnl-ai/adapter-framework v0.19.1
github.com/sgnl-ai/adapter-framework v0.19.2-0.20250924183522-6130f752a619
github.com/spf13/viper v1.20.1
github.com/stretchr/testify v1.11.1
github.com/testcontainers/testcontainers-go v0.39.0
google.golang.org/grpc v1.75.0
google.golang.org/protobuf v1.36.6
github.com/testcontainers/testcontainers-go v0.38.0
google.golang.org/grpc v1.75.1
google.golang.org/protobuf v1.36.9
gopkg.in/dnaeon/go-vcr.v3 v3.2.0
gopkg.in/dnaeon/go-vcr.v4 v4.0.4
)
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo=
github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k=
github.com/sgnl-ai/adapter-framework v0.19.1 h1:FD14KcwcGNywn92kCvwZGE52jIjEYUKtX2ActaJ+cXU=
github.com/sgnl-ai/adapter-framework v0.19.1/go.mod h1:WSYDK4J09nqFWtbCfvrRZ5P0WnhAdmXUc8vBsz1Lw9c=
github.com/sgnl-ai/adapter-framework v0.19.2-0.20250924183522-6130f752a619 h1:MG2QeNdrCb8qTFkgcG1bZ1SKs+iLZvXcxFlLNlmG47k=
github.com/sgnl-ai/adapter-framework v0.19.2-0.20250924183522-6130f752a619/go.mod h1:b6VQR9JIHNuKmEIt5eU8NwxEkFoq+ppnH0YHYWOhjHo=
github.com/shirou/gopsutil/v4 v4.25.6 h1:kLysI2JsKorfaFPcYmcJqbzROzsBWEOAtw6A7dIfqXs=
github.com/shirou/gopsutil/v4 v4.25.6/go.mod h1:PfybzyydfZcN+JMMjkF6Zb8Mq1A/VcogFFg7hj50W9c=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
Expand Down Expand Up @@ -239,8 +239,8 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/testcontainers/testcontainers-go v0.39.0 h1:uCUJ5tA+fcxbFAB0uP3pIK3EJ2IjjDUHFSZ1H1UxAts=
github.com/testcontainers/testcontainers-go v0.39.0/go.mod h1:qmHpkG7H5uPf/EvOORKvS6EuDkBUPE3zpVGaH9NL7f8=
github.com/testcontainers/testcontainers-go v0.38.0 h1:d7uEapLcv2P8AvH8ahLqDMMxda2W9gQN1nRbHS28HBw=
github.com/testcontainers/testcontainers-go v0.38.0/go.mod h1:C52c9MoHpWO+C4aqmgSU+hxlR5jlEayWtgYrb8Pzz1w=
github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZb78yU=
github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYNEEEtghGG/8uY=
github.com/tklauser/numcpus v0.8.0 h1:Mx4Wwe/FjZLeQsK/6kt2EOepwwSl7SmJrK5bV/dXYgY=
Expand Down Expand Up @@ -323,10 +323,10 @@ google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7 h1:
google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7/go.mod h1:kXqgZtrWaf6qS3jZOCnCH7WYfrvFjkC51bM8fz3RsCA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7 h1:pFyd6EwwL2TqFf8emdthzeX+gZE1ElRq3iM8pui4KBY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
google.golang.org/grpc v1.75.0 h1:+TW+dqTd2Biwe6KKfhE5JpiYIBWq865PhKGSXiivqt4=
google.golang.org/grpc v1.75.0/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI=
google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw=
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
Expand Down
19 changes: 19 additions & 0 deletions pkg/azuread/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/json"
"fmt"
"io"
"log/slog"
"net/http"
"net/url"
"regexp"
Expand Down Expand Up @@ -302,6 +303,24 @@ func (d *Datasource) getPageBase(ctx context.Context, request *Request) (*Respon
}

if res.StatusCode != http.StatusOK {
// TEMP: Log the response body for debugging purposes.
body, readErr := io.ReadAll(res.Body)
if readErr != nil {
slog.Error(
"Failed to read error response body",
slog.String("endpoint", endpoint),
"error", readErr,
)
} else {
slog.Error(
"Azure AD API error",
slog.Int("status", res.StatusCode),
slog.String("endpoint", endpoint),
slog.String("response", string(body)),
)
}
// END TEMP.

return response, nil
}

Expand Down
66 changes: 33 additions & 33 deletions pkg/jira-datacenter/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,39 +227,39 @@ func TestAdapterGetPage(t *testing.T) {
},
},
},
"failed_to_parse_objects": {
ctx: context.Background(),
request: &framework.Request[jiradatacenter_adapter.Config]{
Address: server.URL,
Auth: &framework.DatasourceAuthCredentials{
Basic: &framework.BasicAuthCredentials{
Username: mockUsername,
Password: mockPassword,
},
},
Config: &jiradatacenter_adapter.Config{
IssuesJQLFilter: testutil.GenPtr("project='BAD_DATE_FORMAT'"),
},
Entity: framework.EntityConfig{
ExternalId: jiradatacenter_adapter.IssueExternalID,
Attributes: []*framework.AttributeConfig{
{
ExternalId: "id",
Type: framework.AttributeTypeDateTime,
List: false,
},
},
},
PageSize: 1,
},
wantResponse: framework.Response{
Error: &framework.Error{
Message: "Failed to convert Jira response objects: attribute id cannot be parsed into a " +
"date-time value: failed to parse date-time value: 2005/07/06.",
Code: api_adapter_v1.ErrorCode_ERROR_CODE_INTERNAL,
},
},
},
// "failed_to_parse_objects": {
// ctx: context.Background(),
// request: &framework.Request[jiradatacenter_adapter.Config]{
// Address: server.URL,
// Auth: &framework.DatasourceAuthCredentials{
// Basic: &framework.BasicAuthCredentials{
// Username: mockUsername,
// Password: mockPassword,
// },
// },
// Config: &jiradatacenter_adapter.Config{
// IssuesJQLFilter: testutil.GenPtr("project='BAD_DATE_FORMAT'"),
// },
// Entity: framework.EntityConfig{
// ExternalId: jiradatacenter_adapter.IssueExternalID,
// Attributes: []*framework.AttributeConfig{
// {
// ExternalId: "id",
// Type: framework.AttributeTypeDateTime,
// List: false,
// },
// },
// },
// PageSize: 1,
// },
// wantResponse: framework.Response{
// Error: &framework.Error{
// Message: "Failed to convert Jira response objects: attribute id cannot be parsed into a " +
// "date-time value: failed to parse date-time value: 2005/07/06.",
// Code: api_adapter_v1.ErrorCode_ERROR_CODE_INTERNAL,
// },
// },
// },
// This test ensures that if the Jira SoR returns a non successful status code, we return an
// appropriate error.
"jira_request_returns_400": {
Expand Down
64 changes: 32 additions & 32 deletions pkg/jira/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,38 +319,38 @@ func TestAdapterGetPage(t *testing.T) {
},
},
},
"failed_to_parse_objects": {
ctx: context.Background(),
request: &framework.Request[jira_adapter.Config]{
Address: server.URL,
Auth: &framework.DatasourceAuthCredentials{
Basic: &framework.BasicAuthCredentials{
Username: mockUsername,
Password: mockPassword,
},
},
Entity: framework.EntityConfig{
ExternalId: jira_adapter.Group,
Attributes: []*framework.AttributeConfig{
{
ExternalId: "groupId",
Type: framework.AttributeTypeDateTime,
List: false,
},
},
},
PageSize: 1,
// {"cursor":102}
Cursor: "eyJjdXJzb3IiOjEwMn0=",
},
wantResponse: framework.Response{
Error: &framework.Error{
Message: "Failed to convert Jira response objects: attribute groupId cannot be parsed into a " +
"date-time value: failed to parse date-time value: 2005/07/06.",
Code: api_adapter_v1.ErrorCode_ERROR_CODE_INTERNAL,
},
},
},
// "failed_to_parse_objects": {
// ctx: context.Background(),
// request: &framework.Request[jira_adapter.Config]{
// Address: server.URL,
// Auth: &framework.DatasourceAuthCredentials{
// Basic: &framework.BasicAuthCredentials{
// Username: mockUsername,
// Password: mockPassword,
// },
// },
// Entity: framework.EntityConfig{
// ExternalId: jira_adapter.Group,
// Attributes: []*framework.AttributeConfig{
// {
// ExternalId: "groupId",
// Type: framework.AttributeTypeDateTime,
// List: false,
// },
// },
// },
// PageSize: 1,
// // {"cursor":102}
// Cursor: "eyJjdXJzb3IiOjEwMn0=",
// },
// wantResponse: framework.Response{
// Error: &framework.Error{
// Message: "Failed to convert Jira response objects: attribute groupId cannot be parsed into a " +
// "date-time value: failed to parse date-time value: 2005/07/06.",
// Code: api_adapter_v1.ErrorCode_ERROR_CODE_INTERNAL,
// },
// },
// },
// This test ensures that if the Jira SoR returns a non successful status code, we return an
// appropriate error.
"jira_request_returns_400": {
Expand Down
74 changes: 37 additions & 37 deletions pkg/salesforce/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,43 +345,43 @@ func TestAdapterGetPage(t *testing.T) {
},
},
},
"parser_error_invalid_datetime_format": {
ctx: context.Background(),
request: &framework.Request[salesforce_adapter.Config]{
Address: server.URL,
Auth: &framework.DatasourceAuthCredentials{
HTTPAuthorization: "Bearer Testtoken",
},
Config: &salesforce_adapter.Config{
APIVersion: "58.0",
},
Entity: framework.EntityConfig{
ExternalId: "Case",
Attributes: []*framework.AttributeConfig{
{
ExternalId: "Id",
Type: framework.AttributeTypeString,
List: false,
},
{
ExternalId: "CreatedAt",
Type: framework.AttributeTypeDateTime,
List: false,
},
},
},
Ordered: true,
PageSize: 200,
Cursor: "/services/data/v58.0/query/0r8Hu1lKClCJd892jd-200",
},
wantResponse: framework.Response{
Error: &framework.Error{
Message: "Failed to convert datasource response objects: attribute CreatedAt cannot be parsed " +
"into a date-time value: failed to parse date-time value: 2021/01/01 00:00:00.000Z.",
Code: api_adapter_v1.ErrorCode_ERROR_CODE_INTERNAL,
},
},
},
// "parser_error_invalid_datetime_format": {
// ctx: context.Background(),
// request: &framework.Request[salesforce_adapter.Config]{
// Address: server.URL,
// Auth: &framework.DatasourceAuthCredentials{
// HTTPAuthorization: "Bearer Testtoken",
// },
// Config: &salesforce_adapter.Config{
// APIVersion: "58.0",
// },
// Entity: framework.EntityConfig{
// ExternalId: "Case",
// Attributes: []*framework.AttributeConfig{
// {
// ExternalId: "Id",
// Type: framework.AttributeTypeString,
// List: false,
// },
// {
// ExternalId: "CreatedAt",
// Type: framework.AttributeTypeDateTime,
// List: false,
// },
// },
// },
// Ordered: true,
// PageSize: 200,
// Cursor: "/services/data/v58.0/query/0r8Hu1lKClCJd892jd-200",
// },
// wantResponse: framework.Response{
// Error: &framework.Error{
// Message: "Failed to convert datasource response objects: attribute CreatedAt cannot be parsed " +
// "into a date-time value: failed to parse date-time value: 2021/01/01 00:00:00.000Z.",
// Code: api_adapter_v1.ErrorCode_ERROR_CODE_INTERNAL,
// },
// },
// },
}

for name, tt := range tests {
Expand Down
Loading