@@ -105,7 +105,7 @@ func TestIntelRdtSet(t *testing.T) {
105105
106106 for _ , tc := range tcs {
107107 t .Run (tc .name , func (t * testing.T ) {
108- helper := NewIntelRdtTestUtil (t )
108+ helper := NewIntelRdtTestUtil (t , "clos-1" )
109109 helper .config .IntelRdt = tc .config
110110
111111 intelrdt := newManager (helper .config , "" , helper .IntelRdtPath )
@@ -183,19 +183,19 @@ func TestApply(t *testing.T) {
183183
184184 for _ , tt := range tests {
185185 t .Run (tt .name , func (t * testing.T ) {
186- NewIntelRdtTestUtil (t )
187186 id := "abcd-1234"
188- closPath := filepath . Join ( intelRdtRoot , id )
187+ closName := id
189188 if tt .config .ClosID != "" {
190- closPath = filepath . Join ( intelRdtRoot , tt .config .ClosID )
189+ closName = tt .config .ClosID
191190 }
192191
192+ preConfiguredClos := ""
193193 if tt .precreateClos {
194- if err := os .MkdirAll (filepath .Join (closPath , "mon_groups" ), 0o755 ); err != nil {
195- t .Fatal (err )
196- }
194+ preConfiguredClos = closName
197195 }
198- m := newManager (& configs.Config {IntelRdt : & tt .config }, id , closPath )
196+ NewIntelRdtTestUtil (t , preConfiguredClos )
197+
198+ m := newManager (& configs.Config {IntelRdt : & tt .config }, id , filepath .Join (intelRdtRoot , closName ))
199199 err := m .Apply (pid )
200200 if tt .isError && err == nil {
201201 t .Fatal ("expected error, got nil" )
@@ -281,18 +281,16 @@ func TestDestroy(t *testing.T) {
281281
282282 for _ , tt := range tests {
283283 t .Run (tt .name , func (t * testing.T ) {
284- NewIntelRdtTestUtil (t )
285-
286284 id := "abcd-1234"
287- closPath := filepath .Join (intelRdtRoot , id )
285+ closName := id
286+ preConfiguredClos := ""
288287 if tt .config .ClosID != "" {
289- closPath = filepath .Join (intelRdtRoot , tt .config .ClosID )
290- // Pre-create the CLOS directory
291- if err := os .MkdirAll (filepath .Join (closPath , "mon_groups" ), 0o755 ); err != nil {
292- t .Fatal (err )
293- }
288+ closName = tt .config .ClosID
289+ preConfiguredClos = closName
294290 }
295- m := newManager (& configs.Config {IntelRdt : & tt .config }, id , closPath )
291+ NewIntelRdtTestUtil (t , preConfiguredClos )
292+
293+ m := newManager (& configs.Config {IntelRdt : & tt .config }, id , filepath .Join (intelRdtRoot , closName ))
296294 if err := m .Apply (1234 ); err != nil {
297295 t .Fatalf ("Apply() failed: %v" , err )
298296 }
0 commit comments