@@ -403,14 +403,14 @@ func TestScan(t *testing.T) {
403403 t .Run (tc .name , func (t * testing.T ) {
404404 root , err := os .MkdirTemp ("" , "test_new_device_plugin" )
405405 if err != nil {
406- t .Fatalf ("can 't create temporary directory: %+v" , err )
406+ t .Fatalf ("Can 't create temporary directory: %+v" , err )
407407 }
408408 // dirs/files need to be removed for the next test
409409 defer os .RemoveAll (root )
410410
411411 sysfs , devfs , err := createTestFiles (root , tc )
412412 if err != nil {
413- t .Errorf ("unexpected error: %+v" , err )
413+ t .Errorf ("Unexpected error: %+v" , err )
414414 }
415415
416416 plugin := newDevicePlugin (sysfs , devfs , tc .options )
@@ -422,7 +422,7 @@ func TestScan(t *testing.T) {
422422 err = plugin .Scan (notifier )
423423 // Scans in GPU plugin never fail
424424 if err != nil {
425- t .Errorf ("unexpected error: %+v" , err )
425+ t .Errorf ("Unexpected error: %+v" , err )
426426 }
427427 if tc .expectedI915Devs != notifier .i915Count {
428428 t .Errorf ("Expected %d, discovered %d devices (i915)" ,
@@ -465,14 +465,14 @@ func TestScanFails(t *testing.T) {
465465 t .Run (tc .name , func (t * testing.T ) {
466466 root , err := os .MkdirTemp ("" , "test_new_device_plugin" )
467467 if err != nil {
468- t .Fatalf ("can 't create temporary directory: %+v" , err )
468+ t .Fatalf ("Can 't create temporary directory: %+v" , err )
469469 }
470470 // dirs/files need to be removed for the next test
471471 defer os .RemoveAll (root )
472472
473473 sysfs , devfs , err := createTestFiles (root , tc )
474474 if err != nil {
475- t .Errorf ("unexpected error: %+v" , err )
475+ t .Errorf ("Unexpected error: %+v" , err )
476476 }
477477
478478 plugin := newDevicePlugin (sysfs , devfs , tc .options )
@@ -485,7 +485,7 @@ func TestScanFails(t *testing.T) {
485485
486486 err = plugin .Scan (notifier )
487487 if err == nil {
488- t .Error ("unexpected nil error" )
488+ t .Error ("Unexpected nil error" )
489489 }
490490 })
491491}
@@ -545,14 +545,14 @@ func TestScanWithRmAndTiles(t *testing.T) {
545545 t .Run (tc .name , func (t * testing.T ) {
546546 root , err := os .MkdirTemp ("" , "test_new_device_plugin" )
547547 if err != nil {
548- t .Fatalf ("can 't create temporary directory: %+v" , err )
548+ t .Fatalf ("Can 't create temporary directory: %+v" , err )
549549 }
550550 // dirs/files need to be removed for the next test
551551 defer os .RemoveAll (root )
552552
553553 sysfs , devfs , err := createTestFiles (root , tc )
554554 if err != nil {
555- t .Errorf ("unexpected error: %+v" , err )
555+ t .Errorf ("Unexpected error: %+v" , err )
556556 }
557557
558558 plugin := newDevicePlugin (sysfs , devfs , tc .options )
@@ -566,10 +566,10 @@ func TestScanWithRmAndTiles(t *testing.T) {
566566
567567 err = plugin .Scan (notifier )
568568 if err != nil {
569- t .Error ("unexpected error" )
569+ t .Error ("Unexpected error" )
570570 }
571571 if rm .tileCount != expectedTileCounts [i ] {
572- t .Error ("unexpected tilecount for RM" )
572+ t .Error ("Unexpected tilecount for RM" )
573573 }
574574 })
575575 }
@@ -673,7 +673,7 @@ func TestBypath(t *testing.T) {
673673 for _ , td := range tds {
674674 root , err := os .MkdirTemp ("" , "test_bypath_mounting" )
675675 if err != nil {
676- t .Fatalf ("can 't create temporary directory: %+v" , err )
676+ t .Fatalf ("Can 't create temporary directory: %+v" , err )
677677 }
678678 // dirs/files need to be removed for the next test
679679 defer os .RemoveAll (root )
@@ -718,7 +718,7 @@ func TestBypath(t *testing.T) {
718718func TestPciDeviceForCard (t * testing.T ) {
719719 root , err := os .MkdirTemp ("" , "test_pci_device_for_card" )
720720 if err != nil {
721- t .Fatalf ("can 't create temporary directory: %+v" , err )
721+ t .Fatalf ("Can 't create temporary directory: %+v" , err )
722722 }
723723 // dirs/files need to be removed for the next test
724724 defer os .RemoveAll (root )
@@ -729,24 +729,24 @@ func TestPciDeviceForCard(t *testing.T) {
729729 cardDevicePath := filepath .Join (cardPath , "device" )
730730
731731 if err := os .MkdirAll (cardDevicePath , 0750 ); err != nil {
732- t .Fatalf ("couldn't create card's device path" )
732+ t .Fatalf ("Card device path creation failed: %+v" , err )
733733 }
734734
735735 data := "0x5959"
736736
737737 err = os .WriteFile (filepath .Join (cardDevicePath , "device" ), []byte (data ), 0o600 )
738738 if err != nil {
739- t .Fatalf ("device id write failed: %+v" , err )
739+ t .Fatalf ("Device id write failed: %+v" , err )
740740 }
741741
742742 id , err := pciDeviceIDForCard (cardPath )
743743
744744 if err != nil {
745- t .Error ( "failed to get device id for card" )
745+ t .Errorf ( "Failed to get device id for card: %+v" , err )
746746 }
747747
748748 if id != data {
749- t .Errorf ("wrong id received %s vs %s" , id , data )
749+ t .Errorf ("Wrong id received %s vs %s" , id , data )
750750 }
751751
752752 // Check bad device
@@ -755,18 +755,18 @@ func TestPciDeviceForCard(t *testing.T) {
755755 cardDevicePath = filepath .Join (cardPath , "device" )
756756
757757 if err := os .MkdirAll (cardDevicePath , 0750 ); err != nil {
758- t .Fatalf ("couldn't create card's device path" )
758+ t .Fatalf ("Card device path creation failed: %+v" , err )
759759 }
760760
761- err = os .WriteFile (filepath .Join (cardDevicePath , "devicee " ), []byte (data ), 0o600 )
761+ err = os .WriteFile (filepath .Join (cardDevicePath , "devicebad " ), []byte (data ), 0o600 )
762762 if err != nil {
763- t .Fatalf ("device id write failed: %+v" , err )
763+ t .Fatalf ("Device id write failed: %+v" , err )
764764 }
765765
766766 id , err = pciDeviceIDForCard (cardPath )
767767
768768 if err == nil {
769- t .Errorf ("id received when it shouldn't be possible: %s" , id )
769+ t .Errorf ("ID received when it shouldn't be possible: %s" , id )
770770 }
771771}
772772
@@ -782,17 +782,17 @@ func createSymlinks(t *testing.T, base string, links []symlinkItem) {
782782
783783 if _ , err := os .Stat (linkOld ); err != nil {
784784 if err := os .MkdirAll (linkOld , 0o750 ); err != nil && ! errors .Is (err , os .ErrExist ) {
785- t .Fatalf ("failed to create symlink base dir: %+v" , err )
785+ t .Fatalf ("Failed to create symlink base dir: %+v" , err )
786786 }
787787 }
788788
789789 d := filepath .Dir (linkNew )
790790 if err := os .MkdirAll (d , 0o750 ); err != nil {
791- t .Fatal ("failed to create symlink new dir" , err )
791+ t .Fatal ("Failed to create symlink new dir" , err )
792792 }
793793
794794 if err := os .Symlink (linkOld , linkNew ); err != nil {
795- t .Fatal ("failed to create symlink from old to new" , err )
795+ t .Fatal ("Failed to create symlink from old to new" , err )
796796 }
797797 }
798798}
@@ -823,7 +823,7 @@ func createDirs(t *testing.T, base string, dirs []string) {
823823func TestCDIDeviceInclusion (t * testing.T ) {
824824 root , err := os .MkdirTemp ("" , "test_cdidevice" )
825825 if err != nil {
826- t .Fatalf ("can 't create temporary directory: %+v" , err )
826+ t .Fatalf ("Can 't create temporary directory: %+v" , err )
827827 }
828828 // dirs/files need to be removed for the next test
829829 defer os .RemoveAll (root )
@@ -878,7 +878,7 @@ func TestCDIDeviceInclusion(t *testing.T) {
878878 tree , err := plugin .scan ()
879879
880880 if err != nil {
881- t .Error ("failed to get device id for card" )
881+ t .Error ("Failed to get device id for card" )
882882 }
883883
884884 refTree := dpapi .NewDeviceTree ()
@@ -954,13 +954,13 @@ func TestCDIDeviceInclusion(t *testing.T) {
954954 }))
955955
956956 if ! reflect .DeepEqual (tree , refTree ) {
957- t .Error ("received device tree isn't expected\n " , tree , "\n " , refTree )
957+ t .Error ("Received device tree isn't expected\n " , tree , "\n " , refTree )
958958 }
959959
960960 if tree .DeviceTypeCount ("i915" ) != 1 {
961- t .Error ("invalid count for device (i915)" )
961+ t .Error ("Invalid count for device (i915)" )
962962 }
963963 if tree .DeviceTypeCount ("xe" ) != 1 {
964- t .Error ("invalid count for device (xe)" )
964+ t .Error ("Invalid count for device (xe)" )
965965 }
966966}
0 commit comments