@@ -23,6 +23,7 @@ func TestForward(t *testing.T) {
2323
2424 tests := map [string ]struct {
2525 statusCode int
26+ storage string
2627 payloads [][]byte
2728 cancelCtx bool
2829 wantErr bool
@@ -31,40 +32,52 @@ func TestForward(t *testing.T) {
3132 }{
3233 "single_message_accepted" : {
3334 statusCode : http .StatusAccepted ,
35+ storage : CloudwatchStorage ,
3436 payloads : [][]byte {[]byte ("test payload" )},
3537 wantCalls : 1 ,
3638 },
3739 "multiple_messages_accepted" : {
3840 statusCode : http .StatusAccepted ,
41+ storage : CloudwatchStorage ,
3942 payloads : [][]byte {[]byte ("first" ), []byte ("second" ), []byte ("third" )},
4043 wantCalls : 3 ,
4144 },
4245 "empty_channel" : {
4346 statusCode : http .StatusAccepted ,
47+ storage : CloudwatchStorage ,
4448 payloads : [][]byte {},
4549 wantCalls : 0 ,
4650 },
4751 "server_returns_400" : {
4852 statusCode : http .StatusBadRequest ,
53+ storage : CloudwatchStorage ,
4954 payloads : [][]byte {[]byte ("test payload" )},
5055 wantErr : true ,
5156 wantErrMsg : "unexpected status from intake" ,
5257 wantCalls : 1 ,
5358 },
5459 "server_returns_500" : {
5560 statusCode : http .StatusInternalServerError ,
61+ storage : CloudwatchStorage ,
5662 payloads : [][]byte {[]byte ("test payload" )},
5763 wantErr : true ,
5864 wantErrMsg : "unexpected status from intake" ,
5965 wantCalls : 1 ,
6066 },
6167 "context_cancelled" : {
6268 statusCode : http .StatusAccepted ,
69+ storage : CloudwatchStorage ,
6370 payloads : [][]byte {[]byte ("test payload" )},
6471 cancelCtx : true ,
6572 wantErr : true ,
6673 wantCalls : 0 ,
6774 },
75+ "s3_storage" : {
76+ statusCode : http .StatusAccepted ,
77+ storage : S3Storage ,
78+ payloads : [][]byte {[]byte ("test payload" )},
79+ wantCalls : 1 ,
80+ },
6881 }
6982
7083 for name , tc := range tests {
@@ -91,6 +104,9 @@ func TestForward(t *testing.T) {
91104 if got := req .Header .Get ("DD-EVP-ORIGIN-VERSION" ); got != config .ForwarderVersion {
92105 t .Errorf ("DD-EVP-ORIGIN-VERSION = %q, want %q" , got , config .ForwarderVersion )
93106 }
107+ if got := req .Header .Get ("DD-STORAGE-TAG" ); got != tc .storage {
108+ t .Errorf ("DD-STORAGE-TAG = %q, want %q" , got , tc .storage )
109+ }
94110
95111 gr , err := gzip .NewReader (req .Body )
96112 if err != nil {
@@ -111,10 +127,7 @@ func TestForward(t *testing.T) {
111127 }))
112128 defer server .Close ()
113129
114- f := NewForwarder (& config.Config {
115- IntakeURL : server .URL ,
116- APIKey : "test-api-key" ,
117- }, server .Client ())
130+ f := NewForwarder (& config.Config {IntakeURL : server .URL , APIKey : "test-api-key" }, server .Client (), tc .storage )
118131
119132 ctx , cancel := context .WithCancel (context .Background ())
120133 defer cancel ()
0 commit comments