Skip to content

Commit

Permalink
job error is fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksSokolov committed Feb 16, 2023
1 parent 7b9f410 commit 1663880
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions rest/workspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package rest

import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/http"
Expand Down Expand Up @@ -62,7 +63,6 @@ type WorkspaceCreateInputData struct {
}

func WorkspacesCreateHandler() http.HandlerFunc {

return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var creationData WorkspaceCreateInputData
err := json.NewDecoder(r.Body).Decode(&creationData)
Expand Down Expand Up @@ -92,8 +92,19 @@ func WorkspacesCreateHandler() http.HandlerFunc {
WriteResponse(w, http.StatusInternalServerError, nil, nil, "workspace")
}

var strBuffer bytes.Buffer
nsName := &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: creationData.Name,
},
}
_, err = clientset.CoreV1().Namespaces().Create(context.Background(), nsName, metav1.CreateOptions{})
if err != nil {
WriteResponse(w, http.StatusInternalServerError, nil, struct {
Error string
}{Error: fmt.Sprintf("Error %s", err)}, "workspace")
}

var strBuffer bytes.Buffer
strBuffer.WriteString("[")
for _, role := range creationData.Roles {
strBuffer.WriteString("\"")
Expand All @@ -120,12 +131,11 @@ func WorkspacesCreateHandler() http.HandlerFunc {
}

CMOpt := metav1.CreateOptions{}

_, err = clientset.CoreV1().ConfigMaps("argo").Create(r.Context(), &cm, CMOpt)
if err != nil {
WriteResponse(w, http.StatusInternalServerError, nil, struct {
Error string
}{Error: fmt.Sprintf("error getting user home dir: %v\n", err)}, "workspace")
}{Error: fmt.Sprintf("error creating configMap: %v\n", err)}, "workspace")
}

WriteResponse(w, http.StatusCreated, nil, struct {
Expand Down

1 comment on commit 1663880

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage for this commit

60.43%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
apiserver
   config.go0%100%100%0%101–106, 108–111, 113, 117–124, 126–131, 42–48, 51–62, 64, 67–76, 78–95
   apiserver.go60.34%100%100%60.34%100–113, 153–155, 160–163, 165, 174–177, 210–214, 216, 56–58, 60–62, 64–76, 79–85, 87–90, 92–98
auth
   azure_token.go58.14%100%100%58.14%104–105, 127–128, 136–137, 146–147, 67–72, 74–80, 82–86, 88–93, 96–99
   auth.go0%100%100%0%101–104, 107–112, 115–121, 123–126, 129–134, 137–158, 162–166, 168, 22–24, 37–44, 78–87, 90, 93–99
   config.go0%100%100%0%26–35, 37–51, 53–56, 58, 61–72, 74–77
models
   models.go71.39%100%100%71.39%1004–1009, 1011, 1018–1019, 1029–1030, 1038–1040, 1049–1054, 1056, 1080–1081, 1091, 1097–1101, 1108, 1116–1117, 1130–1131, 1143–1144, 1156, 1162–1166, 117, 1175, 118, 1183–1184, 127–138, 140–143, 148–150, 154–155, 169–171, 185–186, 208–209, 217–220, 241–243, 247–249, 256–258, 273–276, 279–281, 283–285, 287–290, 292–293, 360–362, 373–374, 385–386, 394–398, 408–409, 418–419, 430–431, 439–443, 456–458, 470–471, 496, 503–504, 51, 513–514, 52–54, 540, 55, 57, 573–575, 582–584, 590–592, 598–600, 606–608, 614–616, 618–619, 671–672, 682–683, 693–694, 704–705, 715–716, 719–720, 777–778, 79, 799, 80, 800–808, 815–816, 824–825, 845–849, 851, 883–884, 89–91, 912, 919–920, 928–929, 949, 984–985, 993–995
   validate.go60%100%100%60%18–20, 23–24, 33–35, 49–54, 61–62, 66–67
   job.go88%100%100%88%23–24, 41
pkg/secret
   secret.go82.78%100%100%82.78%123–124, 134–135, 149–150, 155–156, 161–162, 167–168, 49–51, 58–59, 72–73, 83–89
   mock.go0%100%100%0%13–20, 22–25, 27–30, 32–35
   config.go0%100%100%0%22–27, 29–31, 33–37, 39–42, 44–51, 54–59, 61–65, 67
pkg/workspace
   mock.go0%100%100%0%13–18, 20–23, 25–28, 30–33
   workspace.go58.39%100%100%58.39%128–129, 136–137, 161–163, 170–172, 181–183, 185–193, 197–199, 202, 204, 207–210, 212–220, 224–226, 229, 231, 242–243, 252–253, 61–65, 67–69
rest
   workflows.go55.43%100%100%55.43%101–102, 112–114, 118–120, 123–126, 130–133, 144–146, 150–152, 154–156, 160–164, 175–177, 181–188, 194–198, 206–207, 214–215, 219–221, 228–229, 234–236, 247–250, 57–59, 62–64, 67–68, 73–75, 85–87, 90–92, 97–99
   components.go57.93%100%100%57.93%108–109, 113–115, 125–127, 131–133, 135–136, 140–143, 153–155, 158–160, 165–167, 169–170, 180–186, 188, 191–198, 207–208, 211–212, 220–222, 230–231, 235–237, 24–25, 251–253, 257–260, 265–268, 279, 28, 280–281, 285–287, 29, 290–293, 297–299, 310–312, 316–318, 326–331, 341–342, 345–346, 353–354, 370–373, 378–379, 381–382, 386–388, 395–396, 400–402, 414–417, 42–43, 92–94, 97–99
   userinfo.go0%100%100%0%10–25
   secrets.go96.94%100%100%96.94%110–112
   volumes.go73.68%100%100%73.68%106–108, 122–124, 128–130, 138–140, 144–146, 160–162, 177–179, 45–47, 53–55, 69–71, 78–79, 85–87
   workspaces.go31.48%100%100%31.48%100–105, 107–139, 141–145, 67–73, 75–88, 90–93, 95–99
   jobs.go51.23%100%100%51.23%100–101, 108–110, 114–116, 121–123, 127–130, 136–138, 143–145, 158–164, 167–168, 188–191, 193–197, 199–203, 205–206, 210–216, 224–226, 230–232, 236–238, 240–242, 256–260, 262–266, 268–272, 274, 284–287, 290–292, 295–298, 303–306, 32, 325–329, 33, 331–335, 337–339, 34, 340–347, 359, 36, 360, 365–366, 37, 381–382, 39, 399, 40, 400–401, 406–407, 409, 41, 410–413, 422–423, 427–429, 436–437, 452–453, 470–471, 477–486, 75–80, 82–86, 88–92, 94
   rest.go65.31%100%100%65.31%110–129, 131–135, 156–157, 164, 175–177, 247, 47–48, 53–54, 56–57, 63–64, 71–73, 76–80, 82–84
storage
   parsequery.go82.91%100%100%82.91%106–107, 138–139, 147–148, 47–48, 62–63, 74–77, 82–83, 87–88, 95–96
   references.go72.50%100%100%72.50%100–101, 23–24, 35–36, 42–43, 46–47, 59–60, 65–66, 76–77, 80–81, 87–88, 96–97
   mongovolumestorage.go74.69%100%100%74.69%110–111, 118–119, 125–126, 136–137, 145–146, 160–161, 172–173, 181–182, 199–200, 213–214, 220–221, 226–227, 27–33, 37–39, 56–57, 67–68, 70–72
   mongo.go62.02%100%100%62.02%100, 1004–1005, 101–102, 1042–1043, 1048–1049, 1059–1060, 1068–1069, 1074–1079, 108, 1081–1089, 109, 1090–1095, 1098–1099, 110, 1100–1127, 1129–1143, 1148–1149, 1167–1168, 1176–1177, 1194–1195, 1214–1215, 1220–1221, 1247–1248, 1261–1262, 1264–1266, 1305–1306, 1311–1312, 1322–1323, 1331–1332, 1337–1350, 139–145, 149–151, 157–163, 166–195, 217–218, 235–236, 249–250, 256–257, 262–263, 267–268, 271–272, 293–301, 305–306, 319–320, 323–324, 328–329, 346–347, 359–360, 396–397, 405–406, 409–410, 443–444, 449–469, 471–477, 479, 503–504, 516–517, 525–526, 530–531, 537–538, 543–544, 551–552, 560–561, 569–570, 581–582, 594–595, 599–600, 608–609, 61, 619, 62, 621–622, 63–65, 651–652, 66, 661–662, 665–666, 67, 671–672, 68, 684–685, 697–698, 70–73, 738–739, 745–746, 75, 756–757, 765–766, 771–784, 787–816, 818–832, 846–847, 853–854, 859–860, 865–869, 87, 870–879, 88, 880–892, 900–901, 91, 912–913, 92–99, 990–991
   local.go0%100%100%0%100–101, 103, 106–112, 114–124, 127, 18–21, 25–31, 33–38, 40, 43–53, 56, 61–67, 69–74, 76, 79–89, 92, 96–99
transpiler
   argo.go100%100%100%100%
   helpers.go74.26%100%100%74.26%101–102, 107–108, 112–113, 123–124, 130, 143, 153, 160–161, 163–164, 171–172, 182, 191, 200, 217–218, 221–222, 227–228, 231–232, 246–247, 254–255, 26, 292–293, 295–297, 311–312, 330–331, 338–339, 343–344, 350–354, 38–44, 46, 85–86
   transpiler.go63.06%100%100%63.06%118–119, 124–128, 143–155, 159–160, 201–229, 23, 230–232, 236–239, 24, 240–252, 254–257, 261–269, 275–277, 282–284, 287–288, 291–292, 296–297, 311–313, 316–317, 322–326, 332–333, 368–374, 403–404, 421–426, 429–430, 433–434, 458–459, 462–463, 471–475, 481–482, 487–488, 491–492, 494–514, 518–521, 525–526, 547–548, 554–555, 572–575, 588–589, 610–611, 617–618, 640–641, 644–646, 65, 653–654, 66, 665–672, 96–98

Please sign in to comment.